home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Misc / emu / Wzonka-Lad.lha / Wzonka-Lad / src / pe.s < prev    next >
Text File  |  2003-12-24  |  105KB  |  3,532 lines

  1.  
  2. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3. ;        wzonka-lad palette editor
  4. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  5.  
  6.         incdir    "NDK_3.9:Include/include_i/"
  7.         include   "exec/memory.i"
  8.         include   "intuition/intuition.i"
  9.         include   "graphics/videocontrol.i"
  10.         include   "graphics/gfx.i"
  11.         include   "graphics/gfxbase.i"
  12.         include   "dos/dos.i"
  13.         include   "dos/dosextens.i"
  14.         include   "libraries/reqtools.i"
  15.         include   "intuition/intuition_lib.i"
  16.         include   "libraries/diskfont_lib.i"
  17.         include   "graphics/graphics_lib.i"
  18.         include   "exec/exec_lib.i"
  19.         include   "dos/dos_lib.i"
  20.         include   "libraries/reqtools_lib.i"
  21.         include   "libraries/gadtools_lib.i"
  22.         include    "devices/inputevent.i"
  23.         include    "devices/keyboard.i"
  24.         include    "libraries/gadtools.i"
  25.         include    "exec/io.i"
  26.  
  27.         incdir    "wzonka-lad_src:"
  28.         include    "screens.i"
  29.         include    "iconstartup.i"
  30.  
  31. ;PGA_Dummy        EQU    (TAG_USER+$31000)
  32. ;PGA_Freedom        EQU    (PGA_Dummy+$0001)
  33.  
  34. ;STRINGA_Dummy        EQU    (TAG_USER+$32000)
  35. ;STRINGA_Justification    EQU    (STRINGA_Dummy+$0010)
  36. ;STRINGA_ReplaceMode    EQU    (STRINGA_Dummy+$000D)
  37.  
  38. ;GA_Dummy                EQU     (TAG_USER+$30000)
  39. ;GA_Disabled             EQU     (GA_Dummy+$000E)
  40. ;GA_TabCycle        EQU    (GA_Dummy+$0024)
  41.  
  42. ;LORIENT_HORIZ        EQU    1
  43. ;LORIENT_VERT        EQU    2
  44.  
  45. TRUE            =1
  46. FALSE            =0
  47.  
  48. ;WriteChunkyPixels    =-1056
  49.  
  50. ExecBase      EQU 4
  51.  
  52. menu_x            =576
  53. menu_y            =222
  54.  
  55. gadgets_x        =0
  56. gadgets_y        =25
  57. font_y_sub        =11
  58. iff_y            =20
  59.  
  60. menu_idcmp        =IDCMP_GADGETUP!IDCMP_GADGETDOWN!IDCMP_CLOSEWINDOW!IDCMP_MOUSEMOVE!IDCMP_MOUSEBUTTONS
  61. menu_flags        =WFLG_CLOSEGADGET!WFLG_DEPTHGADGET!WFLG_DRAGBAR!WFLG_ACTIVATE!WFLG_SMART_REFRESH!WFLG_GIMMEZEROZERO
  62.  
  63. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  64. ;        section    juures,code
  65. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  66.  
  67. gb_emu:        movem.l    d2-d7/a2-a6,-(SP)        ;stack!
  68.         move.l    ExecBase,exec_base        ;cache it locally.
  69.  
  70.         move.l    exec_base,a6
  71.         jsr    Forbid(a6)
  72.         lea    message_port_name,a1
  73.         jsr    FindPort(a6)
  74.         move.l    d0,d7
  75.         jsr    Permit(a6)
  76.         tst.l    d7
  77.         bne.w    quit                ;only one palette editor
  78.                             ;running at a time.
  79.         move.l    exec_base,a6
  80.         lea    disk_font_name,a1
  81.         moveq.l    #0,d0
  82.         jsr    OpenLibrary(a6)
  83.         move.l    d0,disk_font_base
  84.         beq.w    quit
  85.  
  86.         lea    dos_name,a1
  87.         moveq.l    #39,d0
  88.         jsr    OpenLibrary(a6)
  89.         move.l    d0,dos_base
  90.         beq.w    quit
  91.  
  92.         lea    graphics_name,a1
  93.         moveq.l    #39,d0
  94.         jsr    OpenLibrary(a6)
  95.         move.l    d0,graphics_base
  96.         beq.w    quit
  97.  
  98.         lea    intuition_name,a1
  99.         moveq.l    #39,d0
  100.         jsr    OpenLibrary(a6)
  101.         move.l    d0,intuition_base
  102.         beq.w    quit
  103.  
  104.         lea    req_tools_name,a1
  105.         moveq.l    #38,d0
  106.         jsr    OpenLibrary(a6)
  107.         move.l    d0,req_tools_base
  108.         beq.w    quit
  109.  
  110.         lea    gad_tools_name,a1
  111.         moveq.l    #38,d0
  112.         jsr    OpenLibrary(a6)
  113.         move.l    d0,gad_tools_base
  114.         beq.w    quit
  115.  
  116. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  117. ;        allocate the initial memory areas and set some pointers
  118. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  119.  
  120.         lea    list_of_areas,a4        ;the memory list.
  121.         lea    list_of_areas_ptr,a5
  122.         bsr.w    allocate_list            ;allocate memory.
  123.         tst.l    d0                ;errors?
  124.         beq.w    quit                ;yes! quit!
  125.  
  126. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  127. ;        lock the pubscreen
  128. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  129.  
  130.         move.l    intuition_base,a6
  131.         sub.l    a0,a0                ;default pub screen.
  132.         jsr    LockPubScreen(a6)
  133.         move.l    d0,pub_screen_lock
  134.         beq.w    quit
  135.  
  136.         move.l    gad_tools_base,a6
  137.         move.l    d0,a0
  138.         sub.l    a1,a1                ;no tag list.
  139.         jsr    GetVisualInfoA(a6)
  140.         move.l    d0,visual_info
  141.         beq.w    quit
  142.  
  143.         move.l    pub_screen_lock,a0
  144.         lea    sc_RastPort(a0),a0
  145.         moveq.l    #0,d0
  146.         move.w    rp_TxHeight(a0),d0
  147.         move.l    d0,screen_font_y
  148.  
  149.         add.l    #menu_y,d0
  150.         move.l    d0,menu_window_y
  151.  
  152. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  153. ;        convert the colour list
  154. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  155.  
  156.         lea    gameboy_colours,a0
  157.         lea    colours_dat,a1
  158.         moveq.l    #8-1,d0
  159. convert_colours:move.b    1(a0),(a1)+
  160.         move.b    2(a0),(a1)+
  161.         move.b    3(a0),(a1)+
  162.         addq.l    #4,a0
  163.         dbra    d0,convert_colours
  164.  
  165. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  166. ;        center the window
  167. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  168.  
  169.         moveq.l    #0,d0
  170.         moveq.l    #0,d1
  171.         move.l    pub_screen_lock,a0
  172.         move.w    sc_Width(a0),d0
  173.         move.w    sc_Height(a0),d1
  174.         sub.l    #menu_x,d0
  175.         sub.l    menu_window_y,d1
  176.         tst.l    d0
  177.         blt.w    quit
  178.         tst.l    d1
  179.         blt.w    quit
  180.         lsr.w    #1,d0
  181.         lsr.w    #1,d1
  182.         lea    menu_window,a0
  183.         move.w    d0,nw_LeftEdge(a0)
  184.         move.w    d1,nw_TopEdge(a0)
  185.  
  186.         move.l    menu_window_y,d0
  187.         move.w    d0,nw_Height(a0)
  188.         move.w    d0,nw_MaxHeight(a0)
  189.  
  190. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  191. ;        create message port
  192. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  193.  
  194.         move.l    exec_base,a6
  195.         jsr    CreateMsgPort(a6)
  196.         move.l    d0,message_port
  197.         beq.w    quit
  198.  
  199.         move.l    d0,a1
  200.         move.l    #message_port_name,LN_NAME(a1)
  201.         move.b    #1,LN_PRI(a1)
  202.  
  203.         jsr    AddPort(a6)
  204.  
  205.         move.l    colour_message,a0
  206.         move.l    colour_message_name,LN_NAME(a0)
  207.         move.l    message_port,MN_REPLYPORT(a0)
  208.         move.w    #MN_SIZE+8*3,MN_LENGTH(a0)
  209.  
  210. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  211. ;        gadtools
  212. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  213.  
  214.         move.l    gad_tools_base,a6
  215.         lea    context_g_menu,a0
  216.         jsr    CreateContext(a6)
  217.         tst.l    d0
  218.         beq.w    quit
  219.  
  220. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  221. ;        open a font
  222. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  223.  
  224.         move.l    disk_font_base,a6
  225.         lea    font_attr,a0            ;attributes for the font.
  226.         jsr    OpenDiskFont(a6)        ;open the font.
  227.         move.l    d0,font_ptr            ;save the pointer.
  228.         bne.s    font_ok                ;open worked perfectly.
  229.  
  230.         lea    font_attr,a0            ;auxiliary font I.
  231.         move.l    #another_name,(a0)
  232.         jsr    OpenDiskFont(a6)
  233.         move.l    d0,font_ptr
  234.         bne.s    font_ok
  235.  
  236.         clr.b    font_attr_flags            ;not a proportional font.
  237.         lea    font_attr,a0            ;auxiliary font II.
  238.         move.l    #res_font_name,(a0)
  239.         jsr    OpenDiskFont(a6)
  240.         move.l    d0,font_ptr
  241. font_ok:    
  242.  
  243. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  244. ;        allocate reqtools resources for rom loading and
  245. ;        snapshot loading / saving separately
  246. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  247.  
  248.         lea    rt_list,a5
  249.         move.l    req_tools_base,a6
  250. rt_f_alc_req:    tst.l    (a5)
  251.         beq.s    rt_f_alc_done
  252.         move.l    #RT_FILEREQ,d0
  253.         moveq.l    #0,d1
  254.         jsr    rtAllocRequestA(a6)
  255.         move.l    (a5)+,a4
  256.         move.l    d0,(a4)
  257.         beq.w    quit
  258.         bra.s    rt_f_alc_req
  259. rt_f_alc_done:    
  260.  
  261. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  262. ;        create the back pattern map
  263. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  264.  
  265.         lea    back_pattern_bn,a0
  266.         move.l    back_pattern_map,a1
  267.         moveq.l    #2-1,d7
  268. back_pattern_crt:
  269.         move.l    (a0)+,d0
  270.         move.l    (a0)+,d1
  271.         move.w    #menu_y/2-1,d3
  272. back_pattern_crt_y:
  273.         move.w    #menu_x/8/4-1,d2
  274. back_pattern_crt_x_1:
  275.         move.l    d0,(a1)+
  276.         dbra    d2,back_pattern_crt_x_1
  277.         move.w    #menu_x/8/4-1,d2
  278. back_pattern_crt_x_2:
  279.         move.l    d1,(a1)+
  280.         dbra    d2,back_pattern_crt_x_2
  281.         dbra    d3,back_pattern_crt_y
  282.         dbra    d7,back_pattern_crt
  283.  
  284. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  285. ;        init bitmaps
  286. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  287.  
  288.         move.l    back_pattern_map_attr,a0
  289.         move.l    back_pattern_map,a1
  290.         moveq.l    #2,d0
  291.         move.l    #menu_x,d1
  292.         move.l    #menu_y,d2
  293.         bsr.w    init_bit_map
  294.  
  295. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  296. ;        precalc the gfx window game still colours
  297. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  298.  
  299.         move.l    graphics_base,a6
  300.         move.l    image_rast_port_1,a1
  301.         jsr    InitRastPort(a6)
  302.         move.l    image_rast_port_2,a1
  303.         jsr    InitRastPort(a6)
  304.  
  305.         move.l    image_rast_port_1,a0
  306.         move.l    image_tmp_rast_port_1,a1
  307.         bsr.w    copy_rast_port
  308.  
  309.         move.l    image_rast_port_2,a0
  310.         move.l    image_tmp_rast_port_2,a1
  311.         bsr.w    copy_rast_port
  312.  
  313.         move.l    image_map_attr_1,a0
  314.         lea    image_map_1,a1
  315.         bsr.w    init_still_map
  316.         move.l    image_map_attr_2,a0
  317.         lea    image_map_2,a1
  318.         bsr.w    init_still_map
  319.  
  320.         move.l    image_map_attr_1,a4
  321.         lea    image_tmp_map_attr_1,a5
  322.         bsr.w    alloc_bit_map
  323.         tst.l    d0
  324.         beq.w    quit
  325.  
  326.         move.l    d0,a0
  327.         move.w    #176/8,bm_BytesPerRow(a0)
  328.         move.w    #1,bm_Rows(a0)
  329.  
  330.         move.l    image_map_attr_2,a4
  331.         lea    image_tmp_map_attr_2,a5
  332.         bsr.w    alloc_bit_map
  333.         tst.l    d0
  334.         beq.w    quit
  335.  
  336.         move.l    d0,a0
  337.         move.w    #176/8,bm_BytesPerRow(a0)
  338.         move.w    #1,bm_Rows(a0)
  339.  
  340.         move.l    image_rast_port_1,a0
  341.         move.l    image_map_attr_1,rp_BitMap(a0)
  342.         move.l    image_rast_port_2,a0
  343.         move.l    image_map_attr_2,rp_BitMap(a0)
  344.         move.l    image_tmp_rast_port_1,a0
  345.         move.l    image_tmp_map_attr_1,rp_BitMap(a0)
  346.         clr.l    rp_Layer(a0)
  347.         move.l    image_tmp_rast_port_2,a0
  348.         move.l    image_tmp_map_attr_2,rp_BitMap(a0)
  349.         clr.l    rp_Layer(a0)
  350.  
  351.         moveq.l    #0,d0
  352.         moveq.l    #0,d1
  353.         move.l    #175,d2
  354.         moveq.l    #30,d3
  355.         move.l    image_rast_port_1,a0
  356.         move.l    image_tmp_rast_port_1,a1
  357.         move.l    image_array_1,a2
  358.         jsr    ReadPixelArray8(a6)
  359.  
  360.         moveq.l    #0,d0
  361.         moveq.l    #0,d1
  362.         move.l    #175,d2
  363.         moveq.l    #30,d3
  364.         move.l    image_rast_port_2,a0
  365.         move.l    image_tmp_rast_port_2,a1
  366.         move.l    image_array_2,a2
  367.         jsr    ReadPixelArray8(a6)
  368.  
  369.         lea    image_tmp_map_attr_1,a1
  370.         bsr.w    free_bit_maps
  371.         lea    image_tmp_map_attr_2,a1
  372.         bsr.w    free_bit_maps
  373.  
  374.         bsr.w    obtain_pens_and_convert_gfx    ;obtain pens.
  375.         bsr.w    copy_pens            ;copy the pens forward.
  376.  
  377. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  378. ;        create all the gadtools buttons
  379. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  380.  
  381.         lea    menu_gadgets,a4
  382.         lea    context_g_menu,a5
  383.         bsr.w    gadget_crt            ;create gadgets.
  384.         tst.l    d0
  385.         bne.w    quit
  386.  
  387. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  388. ;        load .prefs path from wzonka-lad.prefs
  389. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  390.  
  391.         move.l    exec_base,a6
  392.         move.l    #120,d0
  393.         moveq.l    #MEMF_PUBLIC,d1
  394.         jsr    AllocVec(a6)
  395.         move.l    d0,d7                ;d7 = buffer pointer.
  396.         beq.w    prefs_path_load_error
  397.  
  398.         move.l    dos_base,a6
  399.         move.l    #prefs_file_name,d1
  400.         move.l    #MODE_OLDFILE,d2
  401.         jsr    Open(a6)
  402.         move.l    d0,d6
  403.         beq.w    prefs_path_load_error
  404.  
  405.         move.l    d0,d1
  406.         move.l    #120*2,d2
  407.         move.l    #OFFSET_BEGINNING,d3
  408.         jsr    Seek(a6)
  409.  
  410.         move.l    d6,d1
  411.         move.l    d7,d2
  412.         move.l    #120,d3
  413.         jsr    Read(a6)
  414.  
  415.         move.l    d6,d1
  416.         jsr    Close(a6)
  417.  
  418.         move.l    req_tools_base,a6
  419.         move.l    request_ptr_prefs,a1
  420.         lea    req_change_tags,a0
  421.         move.l    d7,4(a0)            ;new def dir!
  422.         jsr    rtChangeReqAttrA(a6)        ;change to the default dir.
  423.  
  424. prefs_path_load_error:
  425.         move.l    d7,a1
  426.         bsr.w    free_vec
  427.  
  428. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  429. ;        open the window
  430. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  431.  
  432.         move.l    intuition_base,a6
  433.         lea    menu_window,a0
  434.         lea    win_tags_u,a1            ;universal taglist.
  435.         jsr    OpenWindowTagList(a6)        ;structure and open the window.
  436.         move.l    d0,menu_ptr
  437.         beq.w    quit
  438.  
  439. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  440. ;        init new bit maps for the output routines
  441. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  442.  
  443.         move.l    graphics_base,a6
  444.         cmp.w    #40,LIB_VERSION(a6)
  445.         blt.s    no_graphics_lib_v40_or_hw
  446.         tst.l    gb_ChunkyToPlanarPtr(a6)
  447.         beq.s    no_graphics_lib_v40_or_hw
  448.         move.l    #1,chunky_to_planar_hardware
  449.         bra.w    no_tmp_rast_ports
  450.  
  451. no_graphics_lib_v40_or_hw:
  452.         move.l    menu_ptr,a4
  453.         move.l    wd_RPort(a4),a4
  454.         move.l    rp_BitMap(a4),a4
  455.         lea    image_tmp_map_attr_1,a5
  456.         bsr.w    alloc_bit_map
  457.         tst.l    d0
  458.         beq.w    quit
  459.  
  460.         move.l    d0,a0
  461.         move.w    #176/8,bm_BytesPerRow(a0)
  462.         move.w    #1,bm_Rows(a0)
  463.  
  464.         move.l    menu_ptr,a0
  465.         move.l    wd_RPort(a0),a0
  466.         move.l    image_tmp_rast_port_1,a1
  467.         bsr.w    copy_rast_port
  468.  
  469.         move.l    image_tmp_rast_port_1,a0
  470.         move.l    image_tmp_map_attr_1,rp_BitMap(a0)
  471.         clr.l    rp_Layer(a0)
  472.  
  473.         move.l    menu_ptr,a4
  474.         move.l    wd_RPort(a4),a4
  475.         move.l    rp_BitMap(a4),a4
  476.         lea    image_tmp_map_attr_2,a5
  477.         bsr.w    alloc_bit_map
  478.         tst.l    d0
  479.         beq.w    quit
  480.  
  481.         move.l    d0,a0
  482.         move.w    #176/8,bm_BytesPerRow(a0)
  483.         move.w    #1,bm_Rows(a0)
  484.  
  485.         move.l    menu_ptr,a0
  486.         move.l    wd_RPort(a0),a0
  487.         move.l    image_tmp_rast_port_2,a1
  488.         bsr.w    copy_rast_port
  489.  
  490.         move.l    image_tmp_rast_port_2,a0
  491.         move.l    image_tmp_map_attr_2,rp_BitMap(a0)
  492.         clr.l    rp_Layer(a0)
  493.  
  494. no_tmp_rast_ports:
  495.  
  496. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  497. ;        continue with inits
  498. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  499.  
  500.         move.l    graphics_base,a6
  501.         move.l    back_pattern_map_attr,a0    ;a0 = source bitmap.
  502.         move.l    menu_ptr,a1
  503.         move.l    wd_RPort(a1),a1            ;a1 = destination rastport.
  504.         moveq.l    #0,d0                ;org x.
  505.         moveq.l    #0,d1                ;org y.
  506.         moveq.l    #0,d2                ;dst x.
  507.         moveq.l    #0,d3                ;dst y.
  508.         move.l    #menu_x-4-4,d4            ;size x.
  509.         move.l    #menu_y-2-4+1,d5        ;size y.
  510.         move.l    #$c0,d6                ;minterm.
  511.         jsr    BltBitMapRastPort(a6)        ;update the screen window.
  512.  
  513.         lea    menu_bevel_list,a5
  514.         jsr    draw_bevel_list
  515.  
  516.         move.l    intuition_base,a6
  517.         move.l    menu_ptr,a0
  518.         move.l    wd_RPort(a0),a0
  519.         lea    menu_item_text_1,a1
  520.         moveq.l    #0,d0
  521.         moveq.l    #0,d1
  522.         jsr    PrintIText(a6)
  523.  
  524.         lea    colour_box_list,a5
  525.         bsr.w    draw_colour_list
  526.  
  527.         bsr.w    write_still_images
  528.  
  529.         move.l    intuition_base,a6
  530.         move.l    menu_ptr,a0
  531.         move.l    #-1,a1
  532.         lea    menu_scr_txt,a2
  533.         jsr    SetWindowTitles(a6)
  534.  
  535. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  536. ;        refresh the graphics
  537. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  538.  
  539.         move.l    intuition_base,a6
  540.         move.l    menu_ptr,a0
  541.         move.l    context_g_menu,a1
  542.         sub.l    a2,a2
  543.         moveq.l    #-1,d0
  544.         moveq.l    #-1,d1
  545.         jsr    AddGList(a6)
  546.  
  547.         move.l    context_g_menu,a0
  548.         move.l    menu_ptr,a1
  549.         sub.l    a2,a2
  550.         moveq.l    #-1,d0                ;all gadgets.
  551.         jsr    RefreshGList(a6)
  552.  
  553.         move.l    gad_tools_base,a6
  554.         move.l    menu_ptr,a0
  555.         sub.l    a1,a1
  556.         jsr    GT_RefreshWindow(a6)
  557.  
  558. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  559. ;        message loop
  560. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  561.  
  562. get_message:    move.l    dos_base,a6
  563.         moveq.l    #5,d1
  564.         jsr    Delay(a6)
  565.  
  566.         move.l    gad_tools_base,a6
  567.         move.l    menu_ptr,a0
  568.         move.l    wd_UserPort(a0),a0        ;userport -> a0.
  569.         jsr    GT_GetIMsg(a6)            ;get every message.
  570.         tst.l    d0                ;avoid queue.
  571.         bne.w    menu_message
  572.  
  573.         bsr.w    obtain_status
  574.  
  575.         bra.s    get_message
  576.  
  577. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  578. ;        message from the menu window
  579. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  580.  
  581. menu_message:    move.l    exec_base,a6
  582.         move.l    d0,a0
  583.         move.l    im_Class(a0),d0
  584.  
  585.         cmp.l    #IDCMP_CLOSEWINDOW,d0
  586.         beq.s    menu_quit
  587.  
  588.         move.l    im_IAddress(a0),d1        ;address of a gadget.
  589.         moveq.l    #0,d2
  590.         move.w    im_Code(a0),d2            ;menu id data.
  591.  
  592.         movem.l    d0-d2,-(SP)
  593.         move.l    a0,a1                ;a1 = message.
  594.         jsr    ReplyMsg(a6)            ;reply to it.
  595.         movem.l    (SP)+,d0-d2
  596.  
  597.         cmp.l    #IDCMP_GADGETUP,d0
  598.         beq.s    menu_buttons
  599.         cmp.l    #IDCMP_MOUSEMOVE,d0
  600.         beq.w    menu_sliders
  601.  
  602.         bra.w    get_message
  603.  
  604. menu_quit:    move.l    a0,a1                ;a1 = message.
  605.         jsr    ReplyMsg(a6)            ;reply to it.
  606.         bra.w    quit
  607.  
  608. menu_buttons:    moveq.l    #0,d0
  609.         move.l    d1,a0
  610.         move.w    gg_GadgetID(a0),d0        ;d0 = gadget id.
  611.         sub.b    #24,d0
  612.         lea    menu_jump_tbl,a0
  613.         jmp    ([a0,d0.l*4])
  614.  
  615. menu_sliders:    moveq.l    #0,d0
  616.         move.l    d1,a0
  617.         move.w    gg_GadgetID(a0),d0        ;d0 = gadget id.
  618.  
  619.         move.l    d0,-(SP)
  620.         move.l    gad_tools_base,a6
  621.         move.l    menu_ptr,a1
  622.         sub.l    a2,a2
  623.         lea    get_gadget_attrs_tag_list,a3
  624.         jsr    GT_GetGadgetAttrsA(a6)
  625.         move.l    (SP)+,d0
  626.  
  627.         move.l    get_gadget_attrs_tag_return,d1
  628.         lea    colours_dat,a0
  629.         cmp.b    (a0,d0.l),d1
  630.         beq.w    get_message
  631.  
  632.         move.b    d1,(a0,d0.l)            ;store the new colour value.
  633.  
  634.         lea    pen_list,a4
  635.         move.l    (a4),pen_storage_list        ;save the pens.
  636.         move.l    4(a4),pen_storage_list+4        
  637.  
  638.         divu.w    #3,d0
  639.         and.l    #$ff,d0
  640.         move.l    d0,-(SP)
  641.         move.l    graphics_base,a6
  642.         move.l    pub_screen_lock,a0
  643.         lea    sc_ViewPort(a0),a0
  644.         move.l    vp_ColorMap(a0),a0
  645.         move.b    (a4,d0.l),d0
  646.         jsr    ReleasePen(a6)
  647.         move.l    (SP)+,d0
  648.  
  649.         move.l    pub_screen_lock,a0
  650.         lea    sc_ViewPort(a0),a0
  651.         move.l    vp_ColorMap(a0),a0
  652.         lea    colours_dat,a4            ;input (r.B, g.B, b.B).
  653.         lea    pen_list,a3            ;output (.B).
  654.         add.l    d0,a3
  655.         move.l    d0,d1
  656.         mulu.w    #3,d0
  657.         add.l    d0,a4
  658.  
  659.         lea    colour_box_list,a5
  660.         addq.l    #2*4,a5
  661.         mulu.w    #12,d1
  662.         add.l    d1,a5
  663.  
  664.         lea    obtain_pens_tag_list,a1
  665.         moveq.l    #0,d1
  666.         moveq.l    #0,d2
  667.         moveq.l    #0,d3
  668.         move.b    (a4)+,d1
  669.         move.b    (a4)+,d2
  670.         move.b    (a4),d3
  671.         ror.l    #8,d1
  672.         ror.l    #8,d2
  673.         ror.l    #8,d3
  674.         jsr    ObtainBestPenA(a6)
  675.         move.b    d0,(a3)
  676.         and.l    #$ff,d0
  677.         move.l    d0,(a5)
  678.  
  679.         move.l    a5,-(SP)
  680.         bsr.w    remap_still_images        ;remap?
  681.         move.l    (SP)+,a5
  682.  
  683.         tst.l    conversion_occurred        ;is the redrawing needed?
  684.         beq.w    get_message            ;nope, no differences.
  685.  
  686.         move.l    a5,-(SP)
  687.         bsr.w    write_still_images        ;output the images.
  688.         move.l    (SP)+,a5
  689.  
  690.         move.l    (a5),d7
  691.         subq.l    #2*4,a5
  692.         move.l    (a5)+,d0
  693.         move.l    (a5),d1
  694.         bsr.w    draw_colour_box
  695.  
  696.         bra.w    get_message
  697.  
  698. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  699. ;        load .prefs colours
  700. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  701.  
  702. prefs_load:    move.l    req_tools_base,a6
  703.         lea    req_tags,a0            ;the tags.
  704.         move.l    menu_ptr,4(a0)            ;the position pointer.
  705.         move.l    request_ptr_prefs,a1        ;the requester pointer.
  706.         move.l    prefs_name,a2            ;the output area.
  707.         lea    prefs_load_and_save_txt,a3    ;the title text.
  708.         jsr    rtFileRequestA(a6)        ;open a file requester.
  709.  
  710.         move.l    prefs_name_and_dir,a0
  711.         move.l    prefs_name,a1
  712.         move.l    request_ptr_prefs,a2
  713.         bsr.w    parse_req_name
  714.  
  715.         move.l    dos_base,a6
  716.         move.l    prefs_name_and_dir,d1
  717.         move.l    #MODE_OLDFILE,d2
  718.         jsr    Open(a6)
  719.         move.l    d0,d7
  720.         beq.w    prefs_load_error
  721.  
  722.         move.l    d0,d1
  723.         move.l    #colours_dat,d2
  724.         move.l    #3*4*2,d3
  725.         jsr    Read(a6)
  726.  
  727.         move.l    d7,d1
  728.         jsr    Close(a6)
  729.  
  730.         bsr.w    obtain_colours_apply_list    ;use the list.
  731.  
  732. prefs_load_error:
  733.         bra.w    get_message
  734.  
  735. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  736. ;        save .prefs colours
  737. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  738.  
  739. prefs_save:    move.l    req_tools_base,a6
  740.         lea    req_tags,a0            ;the tags.
  741.         move.l    menu_ptr,4(a0)            ;the position pointer.
  742.         move.l    request_ptr_prefs,a1        ;the requester pointer.
  743.         move.l    prefs_name,a2            ;the output area.
  744.         lea    prefs_load_and_save_txt,a3    ;the title text.
  745.         jsr    rtFileRequestA(a6)        ;open a file requester.
  746.  
  747.         move.l    prefs_name_and_dir,a0
  748.         move.l    prefs_name,a1
  749.         move.l    request_ptr_prefs,a2
  750.         bsr.w    parse_req_name
  751.  
  752.         move.l    dos_base,a6
  753.         move.l    prefs_name_and_dir,d1
  754.         move.l    #MODE_OLDFILE,d2
  755.         jsr    Open(a6)
  756.         move.l    d0,d7
  757.         beq.w    prefs_save_error
  758.  
  759.         move.l    d0,d1
  760.         move.l    #colours_dat,d2
  761.         move.l    #3*4*2,d3
  762.         jsr    Write(a6)
  763.  
  764.         move.l    d7,d1
  765.         jsr    Close(a6)
  766.  
  767.         bsr.w    obtain_colours_apply_list    ;use the list.
  768.  
  769. prefs_save_error:
  770.         bra.w    get_message
  771.  
  772. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  773. ;        load .iff file
  774. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  775.  
  776. iff_load:    move.l    req_tools_base,a6
  777.         lea    req_tags,a0            ;the tags.
  778.         move.l    menu_ptr,4(a0)            ;the position pointer.
  779.         move.l    request_ptr_iff,a1        ;the requester pointer.
  780.         move.l    iff_name,a2            ;the output area.
  781.         lea    iff_load_txt,a3            ;the title text.
  782.         jsr    rtFileRequestA(a6)        ;open a file requester.
  783.  
  784.         move.l    iff_name_and_dir,a0
  785.         move.l    iff_name,a1
  786.         move.l    request_ptr_iff,a2
  787.         bsr.w    parse_req_name
  788.  
  789.         move.l    dos_base,a6
  790.         move.l    iff_name_and_dir,d1
  791.         moveq.l    #ACCESS_READ,d2
  792.         jsr    Lock(a6)
  793.         move.l    d0,d6
  794.         beq.w    iff_load_error            ;an error occurred!
  795.  
  796.         move.l    file_info_ptr,d2
  797.         move.l    d0,d1
  798.         jsr    Examine(a6)
  799.  
  800.         move.l    d6,d1
  801.         jsr    UnLock(a6)
  802.  
  803.         move.l    file_info_ptr,a0
  804.         move.l    124(a0),d7            ;d7 = file size.
  805.  
  806. iff_load_allocate_buffer:
  807.         move.l    exec_base,a6
  808.         move.l    d7,d0
  809.         moveq.l    #MEMF_PUBLIC,d1
  810.         jsr    AllocVec(a6)
  811.         move.l    d0,d6                ;d6 = buffer pointer.
  812.         beq.w    iff_load_error
  813.  
  814.         move.l    dos_base,a6
  815.         move.l    iff_name_and_dir,d1
  816.         move.l    #MODE_OLDFILE,d2
  817.         jsr    Open(a6)
  818.         move.l    d0,d5
  819.         beq.w    iff_load_free_buffer
  820.  
  821.         move.l    d0,d1
  822.         move.l    d6,d2
  823.         move.l    d7,d3
  824.         jsr    Read(a6)
  825.  
  826.         move.l    d5,d1
  827.         jsr    Close(a6)
  828.  
  829. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  830. ;        find the CMAP tag
  831. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  832.  
  833.         lea    colours_dat,a0
  834.         move.l    d6,a1
  835.         move.l    d7,d0
  836. iff_find_tag:    cmp.l    #"CMAP",(a1)
  837.         beq.s    iff_found_cmap
  838.         addq.l    #1,a1
  839.         subq.l    #1,d0
  840.         bne.s    iff_find_tag
  841.         bra.s    iff_load_free_buffer
  842.  
  843. iff_found_cmap:    addq.l    #4+4,a1
  844.         moveq.l    #8-1,d0
  845. iff_copy_data:    move.w    (a1)+,(a0)+
  846.         move.b    (a1)+,(a0)+
  847.         dbra    d0,iff_copy_data
  848.  
  849. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  850. ;        use the obtained colours
  851. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  852.  
  853. iff_load_apply_list:
  854.         move.l    d6,-(SP)
  855.         bsr.w    obtain_colours_apply_list    ;use the list.
  856.         move.l    (SP)+,d6
  857.  
  858. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  859. ;        exit .iff loading
  860. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  861.  
  862. iff_load_free_buffer:
  863.         move.l    exec_base,a6
  864.         move.l    d6,a1
  865.         jsr    FreeVec(a6)
  866.  
  867. iff_load_error:    bra.w    get_message
  868.  
  869. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  870. ;        load .cfg file
  871. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  872.  
  873. cfg_load:    move.l    req_tools_base,a6
  874.         lea    req_tags,a0            ;the tags.
  875.         move.l    menu_ptr,4(a0)            ;the position pointer.
  876.         move.l    request_ptr_cfg,a1        ;the requester pointer.
  877.         move.l    cfg_name,a2            ;the output area.
  878.         lea    cfg_load_txt,a3            ;the title text.
  879.         jsr    rtFileRequestA(a6)        ;open a file requester.
  880.  
  881.         move.l    cfg_name_and_dir,a0
  882.         move.l    cfg_name,a1
  883.         move.l    request_ptr_cfg,a2
  884.         bsr.w    parse_req_name
  885.  
  886.         move.l    dos_base,a6
  887.         move.l    cfg_name_and_dir,d1
  888.         moveq.l    #ACCESS_READ,d2
  889.         jsr    Lock(a6)
  890.         move.l    d0,d7
  891.         beq.w    cfg_load_error            ;an error occurred!
  892.  
  893.         move.l    file_info_ptr,d2
  894.         move.l    d0,d1
  895.         jsr    Examine(a6)
  896.  
  897.         move.l    d7,d1
  898.         jsr    UnLock(a6)
  899.  
  900.         move.l    file_info_ptr,a0
  901.         move.l    124(a0),d7            ;d7 = file size.
  902.  
  903. cfg_load_allocate_buffer:
  904.         move.l    exec_base,a6
  905.         move.l    d7,d0
  906.         moveq.l    #MEMF_PUBLIC,d1
  907.         jsr    AllocVec(a6)
  908.         move.l    d0,d6                ;d6 = buffer pointer.
  909.         beq.w    cfg_load_error
  910.  
  911.         move.l    dos_base,a6
  912.         move.l    cfg_name_and_dir,d1
  913.         move.l    #MODE_OLDFILE,d2
  914.         jsr    Open(a6)
  915.         move.l    d0,d5
  916.         beq.w    cfg_load_free_buffer
  917.  
  918.         move.l    d0,d1
  919.         move.l    d6,d2
  920.         move.l    d7,d3
  921.         jsr    Read(a6)
  922.  
  923.         move.l    d5,d1
  924.         jsr    Close(a6)
  925.  
  926. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  927. ;        convert all letters to lower case
  928. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  929.  
  930.         move.l    d6,a0
  931.         move.l    d7,d0
  932.         moveq.l    #0,d1
  933. cfg_load_lower_case_conversion:
  934.         move.b    (a0),d1
  935.         cmp.w    #"A",d1
  936.         blt.s    cfg_load_lower_case_miss
  937.         cmp.w    #"Z",d1
  938.         bgt.s    cfg_load_lower_case_miss
  939.         sub.b    #"A"-"a",(a0)
  940. cfg_load_lower_case_miss:
  941.         addq.l    #1,a0
  942.         subq.l    #1,d0
  943.         bne.s    cfg_load_lower_case_conversion
  944.  
  945. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  946. ;        seek the colour values
  947. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  948.  
  949. cfg_load_seek:    lea    cfg_colour_id_list_long_names,a1
  950.         moveq.l    #(4+4+4)*2+4-1,d1        ;number of choices.
  951.         lea    cfg_colour_id_list_position,a5
  952. cfg_load_execute_long_seek:
  953.         move.l    d6,a0
  954.         move.l    d7,d0
  955.         move.l    (a1)+,a2            ;.B comparison value.
  956.         move.b    (a2)+,d2
  957.         lea    colours_dat,a3
  958.         add.l    (a5)+,a3
  959. cfg_load_execute_long_seeking:
  960.         cmp.b    (a0),d2
  961.         beq.w    cfg_load_execute_long_hit
  962.         addq.l    #1,a0
  963.         subq.l    #1,d0
  964.         bne.s    cfg_load_execute_long_seeking
  965.  
  966.         dbra    d1,cfg_load_execute_long_seek    ;locate the next entry.
  967.         bra.w    cfg_load_apply_list
  968.  
  969. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  970. ;        a hit occurred!
  971. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  972.  
  973. cfg_load_execute_hit:
  974.         addq.l    #1,a0                ;(a0) = "#xyz" / eg. "blue".
  975.         cmp.b    #"#",(a0)
  976.         beq.s    cfg_load_execute_hit_digits
  977. cfg_load_execute_hit_name:
  978.         movem.l    d0-d7/a0-a6,-(SP)
  979.  
  980.         lea    vgb_colours,a4
  981.         lea    vgb_colours_h-3,a5
  982.         move.l    a0,d7
  983. cfg_load_execute_hit_name_validity_check:
  984.         move.l    (a4)+,d0
  985.         beq.s    cfg_load_execute_hit_name_invalid
  986.         move.l    d0,a1
  987.         move.l    d7,a0
  988.         addq.l    #3,a5
  989. cfg_load_execute_hit_name_validity_checking:
  990.         move.b    (a1)+,d2
  991.         beq.s    cfg_load_execute_hit_name_valid
  992.         cmp.b    (a0)+,d2
  993.         bne.s    cfg_load_execute_hit_name_validity_check
  994.         bra.s    cfg_load_execute_hit_name_validity_checking
  995.  
  996. cfg_load_execute_hit_name_valid:
  997.         move.w    (a5)+,(a3)+
  998.         move.b    (a5),(a3)
  999.  
  1000. cfg_load_execute_hit_name_invalid:
  1001.         movem.l    (SP)+,d0-d7/a0-a6
  1002.         rts
  1003.  
  1004. cfg_load_execute_hit_digits:
  1005.         addq.l    #1,a0
  1006.         moveq.l    #3-1,d0
  1007.         moveq.l    #0,d2
  1008.         move.l    a3,a4
  1009. cfg_load_execute_hit_digits_obtain:
  1010.         bsr.b    cfg_load_execute_hit_digits_parse
  1011.         move.b    d2,d3
  1012.         lsl.b    #4,d3
  1013.         bsr.b    cfg_load_execute_hit_digits_parse
  1014.         or.b    d2,d3
  1015.         move.b    d3,(a4)+
  1016.         dbra    d0,cfg_load_execute_hit_digits_obtain
  1017.         rts
  1018.  
  1019. cfg_load_execute_hit_digits_parse:
  1020.         move.b    (a0)+,d2
  1021.         cmp.w    #"0",d2
  1022.         blt.s    cfg_load_execute_hit_digits_no_number
  1023.         cmp.w    #"9",d2
  1024.         bgt.s    cfg_load_execute_hit_digits_no_number
  1025.         sub.b    #"0",d2
  1026.         rts
  1027.  
  1028. cfg_load_execute_hit_digits_no_number:
  1029.         cmp.w    #"a",d2
  1030.         blt.s    cfg_load_execute_hit_digits_no_letter
  1031.         cmp.w    #"f",d2
  1032.         bgt.s    cfg_load_execute_hit_digits_no_letter
  1033.         sub.b    #"a"-$a,d2
  1034.         rts
  1035.  
  1036. cfg_load_execute_hit_digits_no_letter:
  1037.         clr.b    d2
  1038.         rts
  1039.  
  1040. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1041. ;        the first letter was the same
  1042. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1043.  
  1044. cfg_load_execute_long_hit:
  1045.         movem.l    d0-d7/a0-a6,-(SP)
  1046.         addq.l    #1,a0
  1047.  
  1048. cfg_load_execute_long_hit_validity_check:
  1049.         move.b    (a2)+,d2
  1050.         beq.s    cfg_load_execute_long_hit_valid
  1051.         cmp.b    (a0)+,d2
  1052.         bne.s    cfg_load_execute_long_hit_invalid
  1053.         bra.s    cfg_load_execute_long_hit_validity_check
  1054.  
  1055. cfg_load_execute_long_hit_valid:
  1056.         bsr.w    cfg_load_execute_hit
  1057.  
  1058.         movem.l    (SP)+,d0-d7/a0-a6
  1059.         dbra    d1,cfg_load_execute_long_seek    ;locate the next entry.
  1060.         bra.s    cfg_load_apply_list
  1061.  
  1062. cfg_load_execute_long_hit_invalid:
  1063.         movem.l    (SP)+,d0-d7/a0-a6
  1064.         addq.l    #1,a0
  1065.         subq.l    #1,d0
  1066.         bne.w    cfg_load_execute_long_seeking
  1067.  
  1068.         dbra    d1,cfg_load_execute_long_seek    ;locate the next entry.
  1069.  
  1070. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1071. ;        use the obtained colours
  1072. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1073.  
  1074. cfg_load_apply_list:
  1075.         move.l    d6,-(SP)
  1076.         bsr.w    obtain_colours_apply_list    ;use the list.
  1077.         move.l    (SP)+,d6
  1078.  
  1079. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1080. ;        exit .cfg loading
  1081. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1082.  
  1083. cfg_load_free_buffer:
  1084.         move.l    exec_base,a6
  1085.         move.l    d6,a1
  1086.         jsr    FreeVec(a6)
  1087.  
  1088. cfg_load_error:    bra.w    get_message
  1089.  
  1090. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1091. ;        jump table
  1092. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1093.  
  1094. menu_jump_tbl:    dc.l    prefs_load
  1095.         dc.l    prefs_save
  1096.         dc.l    cfg_load
  1097.         dc.l    cfg_save
  1098.         dc.l    obtain_from_wzonka_lad
  1099.         dc.l    interpolate_back_ground
  1100.         dc.l    interpolate_sprites
  1101.  
  1102.         dc.l    copy_left_1
  1103.         dc.l    copy_right_1
  1104.         dc.l    copy_left_2
  1105.         dc.l    copy_right_2
  1106.         dc.l    copy_left_3
  1107.         dc.l    copy_right_3
  1108.         dc.l    copy_left_4
  1109.         dc.l    copy_right_4
  1110.  
  1111.         dc.l    iff_load
  1112.  
  1113. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1114. ;        obtain new colours from wzonka-lad
  1115. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1116.  
  1117. obtain_from_wzonka_lad:
  1118.         move.l    exec_base,a6
  1119.         jsr    Forbid(a6)
  1120.         lea    message_port_wzonka_lad_name,a1
  1121.         jsr    FindPort(a6)
  1122.         move.l    d0,message_port_wzonka_lad
  1123.         jsr    Permit(a6)
  1124.  
  1125.         tst.l    message_port_wzonka_lad
  1126.         beq.w    get_message
  1127.  
  1128.         move.l    message_port_wzonka_lad,a0
  1129.         move.l    colour_message,a1
  1130.         move.l    colour_message_name,a2
  1131.         move.b    #1,(a2)                ;request for the colours.
  1132.         jsr    PutMsg(a6)
  1133.  
  1134.         move.l    message_port,a0
  1135.         jsr    WaitPort(a6)
  1136.  
  1137.         bsr.w    obtain_status_on_get_message
  1138.         bra.w    get_message
  1139.  
  1140. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1141. ;        turn on/off the obtain-gadget?
  1142. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1143.  
  1144. obtain_status:    subq.b    #1,obtain_status_counter
  1145.         bne.s    obtain_status_x
  1146.         move.b    #4,obtain_status_counter
  1147.  
  1148.         move.l    exec_base,a6
  1149.         jsr    Forbid(a6)
  1150.         lea    message_port_wzonka_lad_name,a1
  1151.         jsr    FindPort(a6)
  1152.         move.l    d0,message_port_wzonka_lad
  1153.         jsr    Permit(a6)
  1154.  
  1155.         tst.l    message_port_wzonka_lad
  1156.         bne.s    obtain_on
  1157.  
  1158. obtain_off:    tst.l    obtain_gadget_status
  1159.         bne.s    obtain_status_x
  1160.  
  1161.         move.l    intuition_base,a6
  1162.         move.l    menu_b_5,a0
  1163.         move.l    menu_ptr,a1
  1164.         sub.l    a2,a2
  1165.         jsr    OffGadget(a6)
  1166.  
  1167.         move.l    #1,obtain_gadget_status
  1168. obtain_status_x:rts
  1169.  
  1170. obtain_on:    tst.l    obtain_gadget_status
  1171.         beq.s    obtain_status_on_get_message
  1172.  
  1173.         move.l    intuition_base,a6
  1174.         move.l    menu_b_5,a0
  1175.         move.l    menu_ptr,a1
  1176.         sub.l    a2,a2
  1177.         jsr    OnGadget(a6)
  1178.  
  1179.         clr.l    obtain_gadget_status
  1180. obtain_status_on_get_message:
  1181.         move.l    exec_base,a6
  1182.         move.l    message_port,a0
  1183.         jsr    GetMsg(a6)
  1184.         tst.l    d0
  1185.         beq.s    obtain_status_on_x
  1186.  
  1187. obtain_status_on_message_ready:
  1188.         move.l    d0,a0
  1189.         move.l    LN_NAME(a0),a1
  1190.  
  1191.         move.l    MN_REPLYPORT(a0),d1
  1192.         cmp.l    message_port_wzonka_lad,d1
  1193.         beq.s    send_new_colours
  1194.         cmp.l    message_port,d1
  1195.         beq.s    obtain_new_colours
  1196.  
  1197. obtain_status_reply:
  1198.         move.l    a0,a1
  1199.         jsr    ReplyMsg(a6)            ;send the stuff back.
  1200.  
  1201. obtain_status_on_x:
  1202.         rts
  1203.  
  1204. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1205. ;        send new colours
  1206. ;        INPUT:
  1207. ;        a0    = message.
  1208. ;        a1    = data area (256.B).
  1209. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1210.  
  1211. send_new_colours:
  1212.         lea    colours_dat,a2
  1213.         moveq.l    #8*3/4-1,d0
  1214.         lea    (MN_LENGTH+2)(a0),a3
  1215. copy_colours_data:
  1216.         move.l    (a2)+,(a3)+
  1217.         dbra    d0,copy_colours_data
  1218.  
  1219.         move.l    a0,a1
  1220.         jsr    ReplyMsg(a6)            ;send the colours back.
  1221.         rts
  1222.  
  1223. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1224. ;        obtain new colours
  1225. ;        INPUT:
  1226. ;        a0    = message.
  1227. ;        a1    = data area (256.B).
  1228. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1229.  
  1230. obtain_new_colours:
  1231.         lea    colours_dat,a2
  1232.         moveq.l    #8*3/4-1,d0
  1233.         lea    (MN_LENGTH+2)(a0),a3
  1234. obtain_colours_data:
  1235.         move.l    (a3)+,(a2)+
  1236.         dbra    d0,obtain_colours_data
  1237.  
  1238. obtain_colours_apply_list:
  1239.         lea    pen_list,a4
  1240.         move.l    (a4),pen_storage_list        ;save the pens.
  1241.         move.l    4(a4),pen_storage_list+4        
  1242.         lea    colours_dat,a3
  1243.  
  1244.         move.l    pub_screen_lock,a5
  1245.         lea    sc_ViewPort(a5),a5
  1246.         move.l    vp_ColorMap(a5),a5
  1247.         move.l    graphics_base,a6
  1248.         moveq.l    #8-1,d7
  1249.  
  1250. obtain_change_pens:
  1251.         moveq.l    #0,d0
  1252.         move.b    (a4),d0
  1253.         move.l    a5,a0
  1254.         jsr    ReleasePen(a6)
  1255.  
  1256.         lea    obtain_pens_tag_list,a1
  1257.         moveq.l    #0,d1
  1258.         moveq.l    #0,d2
  1259.         moveq.l    #0,d3
  1260.         move.b    (a3)+,d1
  1261.         move.b    (a3)+,d2
  1262.         move.b    (a3)+,d3
  1263.         ror.l    #8,d1
  1264.         ror.l    #8,d2
  1265.         ror.l    #8,d3
  1266.         move.l    a5,a0
  1267.         jsr    ObtainBestPenA(a6)
  1268.         move.b    d0,(a4)+
  1269.         dbra    d7,obtain_change_pens
  1270.  
  1271.         bsr.w    remap_still_images        ;remap?
  1272.  
  1273.         tst.l    conversion_occurred        ;is the redrawing needed?
  1274.         beq.w    obtain_new_colours_x        ;nope, no differences.
  1275.  
  1276.         bsr.w    write_still_images        ;output the images.
  1277.         bsr.w    copy_pens            ;copy pens.
  1278.  
  1279.         lea    colour_box_list,a5
  1280.         bsr.w    draw_colour_list
  1281.  
  1282. obtain_new_colours_x:
  1283.         move.l    gad_tools_base,a6
  1284.         lea    colours_dat,a4
  1285.         lea    colour_1_r,a5            ;the very first slider.
  1286.         moveq.l    #0,d5
  1287.  
  1288.         moveq.l    #8*3-1,d7
  1289. obtain_new_set_colour_slider_attrs:
  1290.         move.l    (a5)+,a0
  1291.         move.l    menu_ptr,a1
  1292.         sub.l    a2,a2
  1293.         lea    set_gadget_attrs_tag_list,a3
  1294.         move.b    (a4)+,d5
  1295.         move.l    d5,4(a3)
  1296.         jsr    GT_SetGadgetAttrsA(a6)
  1297.         dbra    d7,obtain_new_set_colour_slider_attrs
  1298.         rts
  1299.  
  1300. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1301. ;        copy colours
  1302. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1303.  
  1304. copy_left_1:    moveq.l    #0,d7
  1305.         bra.w    copy_left
  1306.  
  1307. copy_left_2:    moveq.l    #1,d7
  1308.         bra.w    copy_left
  1309.  
  1310. copy_left_3:    moveq.l    #2,d7
  1311.         bra.w    copy_left
  1312.  
  1313. copy_left_4:    moveq.l    #3,d7
  1314.         bra.w    copy_left
  1315.  
  1316. copy_right_1:    moveq.l    #0,d7
  1317.         bra.w    copy_right
  1318.  
  1319. copy_right_2:    moveq.l    #1,d7
  1320.         bra.w    copy_right
  1321.  
  1322. copy_right_3:    moveq.l    #2,d7
  1323.         bra.w    copy_right
  1324.  
  1325. copy_right_4:    moveq.l    #3,d7
  1326.         bra.w    copy_right
  1327.  
  1328. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1329. ;        copy left
  1330. ;        INPUT:
  1331. ;        d7    = number of colour.
  1332. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1333.  
  1334. copy_left:    lea    pen_list,a4
  1335.         move.l    (a4),pen_storage_list        ;save the pens.
  1336.         move.l    4(a4),pen_storage_list+4        
  1337.  
  1338.         lea    colours_dat,a0
  1339.         move.l    d7,d1
  1340.         mulu.w    #3,d1
  1341.         lea    (a0,d1.l),a3
  1342.         add.l    #3*4,d1
  1343.         add.l    d1,a0
  1344.         move.w    (a0)+,(a3)
  1345.         move.b    (a0),2(a3)
  1346.  
  1347.         bra.s    remap_one_colour
  1348.  
  1349. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1350. ;        copy right
  1351. ;        INPUT:
  1352. ;        d7    = number of colour.
  1353. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1354.  
  1355. copy_right:    lea    pen_list,a4
  1356.         move.l    (a4),pen_storage_list        ;save the pens.
  1357.         move.l    4(a4),pen_storage_list+4        
  1358.  
  1359.         lea    colours_dat,a0
  1360.         move.l    d7,d1
  1361.         mulu.w    #3,d1
  1362.         lea    (a0,d1.l),a3
  1363.         add.l    #3*4,d1
  1364.         add.l    d1,a0
  1365.         move.w    (a3),(a0)+
  1366.         move.b    2(a3),(a0)
  1367.  
  1368.         add.b    #4,d7
  1369.         bra.s    remap_one_colour
  1370.  
  1371. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1372. ;        remap only one colour
  1373. ;        INPUT:
  1374. ;        d7    = number of colour.
  1375. ;        a3    = rgb value list.
  1376. ;        a4    = pen list.
  1377. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1378.  
  1379. remap_one_colour:
  1380.         add.l    d7,a4
  1381.         move.l    pub_screen_lock,a5
  1382.         lea    sc_ViewPort(a5),a5
  1383.         move.l    vp_ColorMap(a5),a5
  1384.         move.l    graphics_base,a6
  1385.         moveq.l    #0,d0
  1386.         move.b    (a4),d0
  1387.         move.l    a5,a0
  1388.         jsr    ReleasePen(a6)
  1389.  
  1390.         lea    obtain_pens_tag_list,a1
  1391.         moveq.l    #0,d1
  1392.         moveq.l    #0,d2
  1393.         moveq.l    #0,d3
  1394.         move.b    (a3)+,d1
  1395.         move.b    (a3)+,d2
  1396.         move.b    (a3),d3
  1397.         ror.l    #8,d1
  1398.         ror.l    #8,d2
  1399.         ror.l    #8,d3
  1400.         move.l    a5,a0
  1401.         jsr    ObtainBestPenA(a6)
  1402.         move.b    d0,(a4)
  1403.  
  1404.         move.l    d7,-(SP)
  1405.         bsr.w    remap_still_images        ;remap?
  1406.         move.l    (SP)+,d7
  1407.  
  1408.         tst.l    conversion_occurred        ;is the redrawing needed?
  1409. ;        beq.w    get_message            ;nope, no differences.
  1410.  
  1411.         move.l    d7,-(SP)
  1412.         bsr.w    write_still_images        ;output the images.
  1413.         bsr.w    copy_pens
  1414.         move.l    (SP),d7
  1415.  
  1416.         lea    colour_box_list,a0
  1417.         mulu.w    #3*4,d7
  1418.         add.l    d7,a0
  1419.         move.l    (a0)+,d0
  1420.         move.l    (a0)+,d1
  1421.         move.l    (a0),d7
  1422.         bsr.w    draw_colour_box
  1423.  
  1424.         move.l    (SP)+,d0
  1425.         move.l    gad_tools_base,a6
  1426.         lea    colour_1_r,a5            ;the very first slider.
  1427.         move.l    d0,d1
  1428.         mulu.w    #12,d0
  1429.         add.l    d0,a5
  1430.         moveq.l    #0,d5
  1431.         lea    colours_dat,a4
  1432.         mulu.w    #3,d1
  1433.         add.l    d1,a4
  1434.  
  1435.         moveq.l    #3-1,d7
  1436. set_colour_slider_attributes:
  1437.         move.l    (a5)+,a0
  1438.         move.l    menu_ptr,a1
  1439.         sub.l    a2,a2
  1440.         lea    set_gadget_attrs_tag_list,a3
  1441.         move.b    (a4)+,d5
  1442.         move.l    d5,4(a3)
  1443.         jsr    GT_SetGadgetAttrsA(a6)
  1444.         dbra    d7,set_colour_slider_attributes
  1445.  
  1446.         bra.w    get_message
  1447.  
  1448. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1449. ;        save .cfg colours
  1450. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1451.  
  1452. cfg_save:    move.l    req_tools_base,a6
  1453.         lea    req_tags,a0            ;the tags.
  1454.         move.l    menu_ptr,4(a0)            ;the position pointer.
  1455.         move.l    request_ptr_cfg,a1        ;the requester pointer.
  1456.         move.l    cfg_name,a2            ;the output area.
  1457.         lea    cfg_save_txt,a3            ;the title text.
  1458.         jsr    rtFileRequestA(a6)        ;open a file requester.
  1459.  
  1460.         move.l    cfg_name_and_dir,a0
  1461.         move.l    cfg_name,a1
  1462.         move.l    request_ptr_cfg,a2
  1463.         bsr.w    parse_req_name
  1464.  
  1465. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1466. ;        encode the colour values
  1467. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1468.  
  1469.         lea    cfg_colours_output,a0        ;pointer list.
  1470.         lea    colours_dat,a1
  1471.         bsr.w    encode_four_colours
  1472.  
  1473.         lea    cfg_colours_output+4*4,a0
  1474.         lea    colours_dat,a1
  1475.         bsr.w    encode_four_colours
  1476.  
  1477.         lea    cfg_colours_output+4*4*2,a0
  1478.         lea    colours_dat+4*3,a1
  1479.         bsr.w    encode_four_colours
  1480.  
  1481. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1482. ;        save the file
  1483. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1484.  
  1485.         move.l    dos_base,a6            ;open the data file.
  1486.         move.l    cfg_name_and_dir,d1        ;the name of the file.
  1487.         move.l    #MODE_NEWFILE,d2
  1488.         jsr    Open(a6)
  1489.         move.l    d0,d7
  1490.         beq.w    cfg_save_error            ;file error!
  1491.  
  1492.         move.l    d0,d1
  1493.         move.l    #cfg_save_file,d2        ;output address.
  1494.         move.l    #cfg_save_file_end-cfg_save_file,d3
  1495.                             ;the length.
  1496.         jsr    Write(a6)
  1497.  
  1498.         move.l    d7,d1
  1499.         jsr    Close(a6)
  1500.  
  1501. cfg_save_error:    bra.w    get_message            ;back to the loop.
  1502.  
  1503. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1504. ;        encode four colours
  1505. ;        INPUT:
  1506. ;        a0    = pointer list.
  1507. ;        a1    = colour values.
  1508. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1509.  
  1510. encode_four_colours:
  1511.         moveq.l    #4-1,d0
  1512. encode_four_colours_rgb:
  1513.         moveq.l    #3-1,d1
  1514.         move.l    (a0)+,a2
  1515. encode_four_colours_byte:
  1516.         move.b    (a1)+,d2
  1517.         move.b    d2,d3
  1518.         lsr.b    #4,d3
  1519.         bsr.b    encode_four_colours_nibble
  1520.         and.b    #$f,d2
  1521.         move.b    d2,d3
  1522.         bsr.b    encode_four_colours_nibble
  1523.         dbra    d1,encode_four_colours_byte
  1524.         dbra    d0,encode_four_colours_rgb
  1525.         rts
  1526.  
  1527. encode_four_colours_nibble:
  1528.         cmp.b    #$a,d3
  1529.         blt.s    encode_four_colours_number
  1530. encode_four_colours_letter:
  1531.         add.b    #'a'-$a,d3
  1532.         move.b    d3,(a2)+
  1533.         rts
  1534. encode_four_colours_number:
  1535.         add.b    #'0',d3
  1536.         move.b    d3,(a2)+
  1537.         rts
  1538.  
  1539. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1540. ;        interpolate colours
  1541. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1542.  
  1543. interpolate_back_ground:
  1544.         moveq.l    #4,d0
  1545.         bra.s    interpolate_colours
  1546.  
  1547. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1548. ;        interpolate colours
  1549. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1550.  
  1551. interpolate_sprites:
  1552.         moveq.l    #0,d0
  1553. ;        bra.s    interpolate_colours
  1554.  
  1555. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1556. ;        interpolate colours
  1557. ;        INPUT:
  1558. ;        d0    = starting colour.
  1559. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1560.  
  1561. interpolate_colours:
  1562.         move.l    d0,-(SP)
  1563.  
  1564.         lea    colours_dat,a4
  1565.         mulu.w    #3,d0
  1566.  
  1567.         add.l    d0,a4
  1568.         move.l    (a4),d1                ;c0.
  1569.         lsr.l    #8,d1
  1570.         move.l    3(a4),d2            ;c1.
  1571.         lsr.l    #8,d2
  1572.         move.l    6(a4),d3            ;c2.
  1573.         lsr.l    #8,d3
  1574.         move.l    9(a4),d4            ;c3.
  1575.         lsr.l    #8,d4
  1576.  
  1577.         moveq.l    #0,d5
  1578.         moveq.l    #0,d6
  1579.         move.b    d1,d5                ;b.
  1580.         move.b    d4,d6
  1581.         sub.l    d5,d6
  1582.         divs.l    #3,d6                ;d6 = delta blue.
  1583.         add.l    d6,d5
  1584.         move.b    d5,d2
  1585.         add.l    d6,d5
  1586.         move.b    d5,d3                ;b done.
  1587.  
  1588.         moveq.l    #0,d5
  1589.         moveq.l    #0,d6
  1590.         move.w    d1,d5                ;g.
  1591.         move.w    d4,d6
  1592.         clr.b    d5
  1593.         clr.b    d6
  1594.         sub.l    d5,d6
  1595.         divs.l    #3,d6                ;d6 = delta green.
  1596.         add.l    d6,d5
  1597.         move.b    d2,d5
  1598.         move.w    d5,d2
  1599.         add.l    d6,d5
  1600.         move.b    d3,d5
  1601.         move.w    d5,d3                ;g done.
  1602.  
  1603.         move.l    d1,d5                ;r.
  1604.         move.l    d4,d6
  1605.         clr.w    d5
  1606.         clr.w    d6
  1607.         sub.l    d5,d6
  1608.         divs.l    #3,d6                ;d6 = delta red.
  1609.         add.l    d6,d5
  1610.         move.w    d2,d5
  1611.         move.l    d5,d2
  1612.         add.l    d6,d5
  1613.         move.w    d3,d5
  1614.         move.l    d5,d3                ;r done.
  1615.  
  1616.         move.b    d2,5(a4)
  1617.         lsr.l    #8,d2
  1618.         move.b    d2,4(a4)
  1619.         lsr.w    #8,d2
  1620.         move.b    d2,3(a4)
  1621.  
  1622.         move.b    d3,8(a4)
  1623.         lsr.l    #8,d3
  1624.         move.b    d3,7(a4)
  1625.         lsr.w    #8,d3
  1626.         move.b    d3,6(a4)
  1627.  
  1628.         move.l    (SP),d0
  1629.         addq.b    #1,d0
  1630.         addq.l    #3,a4
  1631.  
  1632.         move.l    gad_tools_base,a6
  1633.         lea    colour_1_r,a5            ;the very first slider.
  1634.         mulu.w    #12,d0
  1635.         add.l    d0,a5
  1636.         moveq.l    #0,d5
  1637.  
  1638.         moveq.l    #2*3-1,d7
  1639. set_colour_slider_attrs:
  1640.         move.l    (a5)+,a0
  1641.         move.l    menu_ptr,a1
  1642.         sub.l    a2,a2
  1643.         lea    set_gadget_attrs_tag_list,a3
  1644.         move.b    (a4)+,d5
  1645.         move.l    d5,4(a3)
  1646.         jsr    GT_SetGadgetAttrsA(a6)
  1647.         dbra    d7,set_colour_slider_attrs
  1648.  
  1649.         move.l    (SP)+,d0
  1650.         addq.b    #1,d0                ;to the second colour.
  1651.  
  1652.         lea    pen_list,a4
  1653.         move.l    (a4),pen_storage_list        ;save the pens.
  1654.         move.l    4(a4),pen_storage_list+4        
  1655.         add.l    d0,a4
  1656.         lea    colours_dat,a3
  1657.         mulu.w    #3,d0
  1658.         add.l    d0,a3
  1659.  
  1660.         move.l    pub_screen_lock,a5
  1661.         lea    sc_ViewPort(a5),a5
  1662.         move.l    vp_ColorMap(a5),a5
  1663.         move.l    graphics_base,a6
  1664.         moveq.l    #2-1,d7
  1665.  
  1666. change_pens:    moveq.l    #0,d0
  1667.         move.b    (a4),d0
  1668.         move.l    a5,a0
  1669.         jsr    ReleasePen(a6)
  1670.  
  1671.         lea    obtain_pens_tag_list,a1
  1672.         moveq.l    #0,d1
  1673.         moveq.l    #0,d2
  1674.         moveq.l    #0,d3
  1675.         move.b    (a3)+,d1
  1676.         move.b    (a3)+,d2
  1677.         move.b    (a3)+,d3
  1678.         ror.l    #8,d1
  1679.         ror.l    #8,d2
  1680.         ror.l    #8,d3
  1681.         move.l    a5,a0
  1682.         jsr    ObtainBestPenA(a6)
  1683.         move.b    d0,(a4)+
  1684.         dbra    d7,change_pens
  1685.  
  1686.         bsr.w    remap_still_images        ;remap?
  1687.  
  1688.         tst.l    conversion_occurred        ;is the redrawing needed?
  1689.         beq.w    get_message            ;nope, no differences.
  1690.  
  1691.         bsr.w    write_still_images        ;output the images.
  1692.         bsr.w    copy_pens            ;copy pens.
  1693.  
  1694.         lea    colour_box_list,a5
  1695.         bsr.w    draw_colour_list
  1696.  
  1697.         bra.w    get_message
  1698.  
  1699. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1700. ;        allocate bit map (tmp)
  1701. ;        INPUT:
  1702. ;        a4    = another bit map.
  1703. ;        a5    = place for pointer.
  1704. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1705.  
  1706. alloc_bit_map:    move.l    #176,d0
  1707.         moveq.l    #1,d1
  1708.         moveq.l    #0,d2
  1709.         move.b    bm_Depth(a4),d2
  1710.         moveq.l    #0,d3
  1711.         sub.l    a0,a0
  1712.         move.l    graphics_base,a6
  1713.         jsr    AllocBitMap(a6)
  1714.         move.l    d0,(a5)
  1715.         rts
  1716.  
  1717. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1718. ;        init the given bitmap
  1719. ;        INPUT:
  1720. ;        d0    = z.
  1721. ;        d1    = x.
  1722. ;        d2    = y.
  1723. ;        a0    = attributes.
  1724. ;        a1    = planes.
  1725. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1726.  
  1727. init_bit_map:    lea    bm_Planes(a0),a2
  1728.         move.l    d1,d3
  1729.         lsr.w    #3,d3
  1730.         mulu.w    d2,d3                ;d3 = x/8*y.
  1731.         move.w    d0,d7
  1732.         subq.w    #1,d7
  1733. init_bit_map_pt:move.l    a1,(a2)+
  1734.         add.l    d3,a1
  1735.         dbra    d7,init_bit_map_pt
  1736.  
  1737.         move.l    graphics_base,a6
  1738.         jsr    InitBitMap(a6)
  1739.         rts
  1740.  
  1741. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1742. ;        remap
  1743. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1744.  
  1745. remap_still_images:
  1746.         move.l    pen_list,d0
  1747.         cmp.l    pen_storage_list,d0
  1748.         bne.s    convert_all_pens        ;pen(s) have changed.
  1749.         move.l    pen_list+4,d0
  1750.         cmp.l    pen_storage_list+4,d0
  1751.         bne.s    convert_all_pens
  1752.         clr.l    conversion_occurred
  1753.         rts                    ;no conversion.
  1754.  
  1755. convert_all_pens:
  1756.         move.l    #1,conversion_occurred        ;the image has to be
  1757.                             ;redrawn.
  1758.         move.l    image_array_1,a0
  1759.         move.l    image_tmp_array_1,a1
  1760.         lea    pen_list,a2
  1761.         move.w    #(176*31)-1,d0
  1762.         moveq.l    #0,d1
  1763. remap_convert_pens:
  1764.         move.b    (a0)+,d1
  1765.         move.b    (a2,d1.l),(a1)+
  1766.         dbra    d0,remap_convert_pens
  1767.  
  1768.         move.l    image_array_2,a0
  1769.         move.l    image_tmp_array_2,a1
  1770.         lea    pen_list,a2
  1771.         move.w    #(176*31)-1,d0
  1772.         moveq.l    #0,d1
  1773. remap_convert_pens_x:
  1774.         move.b    (a0)+,d1
  1775.         move.b    (a2,d1.l),(a1)+
  1776.         dbra    d0,remap_convert_pens_x
  1777.         rts
  1778.  
  1779. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1780. ;        write still images
  1781. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1782.  
  1783. write_still_images:
  1784.         move.l    graphics_base,a6
  1785.         tst.l    chunky_to_planar_hardware
  1786.         bne.s    use_write_chunky_pixels
  1787.  
  1788.         move.l    #132,d0
  1789.         move.l    #185-font_y_sub,d1
  1790.         move.l    #132+175,d2
  1791.         move.l    #185+30-font_y_sub,d3
  1792.         move.l    menu_ptr,a0
  1793.         move.l    wd_RPort(a0),a0
  1794.         move.l    image_tmp_rast_port_1,a1
  1795.         move.l    image_tmp_array_1,a2
  1796.         jsr    WritePixelArray8(a6)
  1797.  
  1798.         move.l    #362,d0
  1799.         move.l    #185-font_y_sub,d1
  1800.         move.l    #362+175,d2
  1801.         move.l    #185+30-font_y_sub,d3
  1802.         move.l    menu_ptr,a0
  1803.         move.l    wd_RPort(a0),a0
  1804.         move.l    image_tmp_rast_port_2,a1
  1805.         move.l    image_tmp_array_2,a2
  1806.         jsr    WritePixelArray8(a6)
  1807.         rts
  1808.  
  1809. use_write_chunky_pixels:
  1810.         move.l    #132,d0
  1811.         move.l    #185-font_y_sub,d1
  1812.         move.l    #132+175,d2
  1813.         move.l    #185+30-font_y_sub,d3
  1814.         move.l    #176,d4
  1815.         move.l    menu_ptr,a0
  1816.         move.l    wd_RPort(a0),a0
  1817.         move.l    image_tmp_array_1,a2
  1818.         jsr    WriteChunkyPixels(a6)
  1819.  
  1820.         move.l    #362,d0
  1821.         move.l    #185-font_y_sub,d1
  1822.         move.l    #362+175,d2
  1823.         move.l    #185+30-font_y_sub,d3
  1824.         move.l    #176,d4
  1825.         move.l    menu_ptr,a0
  1826.         move.l    wd_RPort(a0),a0
  1827.         move.l    image_tmp_array_2,a2
  1828.         jsr    WriteChunkyPixels(a6)
  1829.         rts
  1830.  
  1831. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1832. ;        create gadgets
  1833. ;        INPUT:
  1834. ;        a4    = gadget list
  1835. ;        a5    = the first gadget
  1836. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1837.  
  1838. gadget_crt:    move.l    gad_tools_base,a6
  1839.  
  1840. gadget_crt_s:    move.l    univ_gadget,a1
  1841.         move.w    (a4)+,gng_LeftEdge(a1)        ;x.
  1842.         beq.w    gadget_crt_x            ;end of gadgets.
  1843.         move.w    (a4)+,gng_TopEdge(a1)        ;y.
  1844.         move.l    (a4)+,gng_Flags(a1)        ;flags.
  1845.         move.l    (a4)+,gng_GadgetText(a1)    ;text.
  1846.         move.w    (a4)+,gng_GadgetID(a1)        ;id number.
  1847.         move.l    #font_attr,gng_TextAttr(a1)
  1848.         move.l    visual_info,gng_VisualInfo(a1)
  1849.  
  1850.         move.l    (a5),a0
  1851.         move.w    (a4)+,d1
  1852.         beq.s    gadget_crt_btn            ;no tags! (button_kind).
  1853.         cmp.b    #1,d1
  1854.         beq.s    gadget_crt_mx            ;mx_kind!
  1855.         cmp.b    #2,d1
  1856.         beq.s    gadget_crt_str            ;string_kind!
  1857.         cmp.b    #3,d1
  1858.         beq.w    gadget_crt_lw            ;listview_kind!
  1859.         cmp.b    #4,d1
  1860.         beq.w    gadget_crt_sld            ;slider_kind!
  1861.  
  1862. gadget_crt_mx:    move.w    #17,gng_Width(a1)        ;dx.
  1863.         move.w    #9,gng_Height(a1)        ;dy.
  1864.         move.l    (a4)+,a2
  1865.         move.l    (a4)+,4(a2)
  1866.         move.l    #MX_KIND,d0            ;gadget type.
  1867.         jsr    CreateGadgetA(a6)
  1868.  
  1869.         move.l    (a4)+,a5
  1870.         move.l    d0,(a5)
  1871.         beq.w    gadget_crt_err
  1872.         bra.w    gadget_crt_s
  1873.  
  1874. gadget_crt_btn:    move.w    (a4)+,gng_Width(a1)        ;dx.
  1875.         move.w    (a4)+,gng_Height(a1)        ;dy.
  1876.         sub.l    a2,a2                ;no tags!
  1877.         move.l    #BUTTON_KIND,d0
  1878.         jsr    CreateGadgetA(a6)
  1879.  
  1880.         move.l    (a4)+,a5
  1881.         move.l    d0,(a5)
  1882.         beq.s    gadget_crt_err
  1883.         bra.w    gadget_crt_s
  1884.  
  1885. gadget_crt_str:    move.w    (a4)+,gng_Width(a1)        ;dx.
  1886.         move.w    (a4)+,gng_Height(a1)        ;dy.
  1887.         move.l    (a4)+,a2
  1888.         move.l    (a4)+,a5
  1889.         move.l    (a5),4(a2)
  1890.         move.l    #STRING_KIND,d0
  1891.         jsr    CreateGadgetA(a6)
  1892.  
  1893.         move.l    (a4)+,a5
  1894.         move.l    d0,(a5)
  1895.         beq.s    gadget_crt_err
  1896.         bra.w    gadget_crt_s
  1897.  
  1898. gadget_crt_lw:    move.w    (a4)+,gng_Width(a1)        ;dx.
  1899.         move.w    (a4)+,gng_Height(a1)        ;dy.
  1900.         move.l    (a4)+,a2
  1901.         move.l    #LISTVIEW_KIND,d0
  1902.         jsr    CreateGadgetA(a6)
  1903.  
  1904.         move.l    (a4)+,a5
  1905.         move.l    d0,(a5)
  1906.         beq.s    gadget_crt_err
  1907.         bra.w    gadget_crt_s
  1908.  
  1909. gadget_crt_sld:    move.w    (a4)+,gng_Width(a1)        ;dx.
  1910.         move.w    (a4)+,gng_Height(a1)        ;dy.
  1911.         move.l    (a4)+,a2
  1912.         lea    colours_dat,a5
  1913.         moveq.l    #0,d0
  1914.         move.w    gng_GadgetID(a1),d0
  1915.         move.b    (a5,d0.l),d0
  1916.         move.l    d0,4(a2)            ;new level.
  1917.         move.l    #SLIDER_KIND,d0            ;gadget type.
  1918.         jsr    CreateGadgetA(a6)
  1919.  
  1920.         move.l    (a4)+,a5
  1921.         move.l    d0,(a5)
  1922.         beq.s    gadget_crt_err
  1923.         bra.w    gadget_crt_s
  1924.  
  1925. gadget_crt_x:    moveq.l    #0,d0
  1926.         rts
  1927. gadget_crt_err:    moveq.l    #1,d0
  1928.         rts
  1929.  
  1930. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1931. ;        quit / exit
  1932. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  1933.  
  1934. quit:        bsr.w    free_pens_list
  1935.  
  1936.         move.l    intuition_base,a6
  1937.         sub.l    a0,a0                ;no name.
  1938.         move.l    pub_screen_lock,d0
  1939.         beq.s    no_pub_lock
  1940.         move.l    d0,a1
  1941.         jsr    UnlockPubScreen(a6)
  1942.  
  1943. no_pub_lock:    move.l    request_ptr_cfg,d0
  1944.         bsr.w    free_reqs
  1945.         move.l    request_ptr_prefs,d0
  1946.         bsr.w    free_reqs
  1947.         move.l    request_ptr_iff,d0
  1948.         bsr.w    free_reqs
  1949.  
  1950.         move.l    font_ptr,d0
  1951.         beq.s    no_font                ;no font opened.
  1952.         move.l    d0,a1
  1953.         move.l    graphics_base,a6
  1954.         jsr    CloseFont(a6)            ;close the font.
  1955.  
  1956. no_font:    move.l    menu_ptr,d0
  1957.         bsr.w    close_window
  1958.  
  1959.         move.l    context_g_menu,d0
  1960.         bsr.w    free_gadgets
  1961.  
  1962.         move.l    gad_tools_base,a6
  1963.         move.l    visual_info,d0
  1964.         beq.s    no_visual_info
  1965.         move.l    d0,a0
  1966.         jsr    FreeVisualInfo(a6)
  1967.  
  1968. no_visual_info:    move.l    message_port,d0
  1969.         beq.s    no_message_port
  1970.         move.l    d0,a1
  1971.         move.l    exec_base,a6
  1972.         jsr    RemPort(a6)
  1973.  
  1974.         move.l    message_port,a0
  1975.         jsr    DeleteMsgPort(a6)
  1976.  
  1977. no_message_port:lea    image_tmp_map_attr_1,a1
  1978.         bsr.w    free_bit_maps
  1979.         lea    image_tmp_map_attr_2,a1
  1980.         bsr.w    free_bit_maps
  1981.  
  1982.         lea    list_of_areas_ptr,a5
  1983.         bsr.w    free_vectors            ;free the allocated memory.
  1984.  
  1985.         move.l    req_tools_base,d0
  1986.         bsr.b    free_libs
  1987.         move.l    gad_tools_base,d0
  1988.         bsr.b    free_libs
  1989.         move.l    graphics_base,d0
  1990.         bsr.b    free_libs
  1991.         move.l    dos_base,d0
  1992.         bsr.b    free_libs
  1993.         move.l    disk_font_base,d0
  1994.         bsr.b    free_libs
  1995.  
  1996.         movem.l    (SP)+,d2-d7/a2-a6        ;unstack!
  1997.         moveq.l    #0,d0                ;no errors.
  1998.         rts
  1999.  
  2000. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2001. ;        misc closes
  2002. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2003.  
  2004. free_vec:    move.l    a1,d0
  2005.         beq.s    free_vec_x
  2006.         move.l    exec_base,a6
  2007.         jsr    FreeVec(a6)            ;free the area.
  2008. free_vec_x:    rts
  2009.  
  2010. free_reqs:    move.l    d0,a1
  2011.         beq.s    free_reqs_x
  2012.         move.l    req_tools_base,a6
  2013.         jsr    rtFreeRequest(a6)        ;free the requester
  2014. free_reqs_x:    rts
  2015.  
  2016. free_libs:    move.l    d0,a1
  2017.         beq.s    free_libs_x
  2018.         move.l    exec_base,a6
  2019.         jsr    CloseLibrary(a6)
  2020. free_libs_x:    rts
  2021.  
  2022. close_window:    move.l    d0,a0
  2023.         beq.s    close_window_x
  2024.         move.l    intuition_base,a6
  2025.         jsr    CloseWindow(a6)
  2026. close_window_x:    rts
  2027.  
  2028. free_gadgets:    move.l    d0,a0
  2029.         beq.s    free_gadgets_x
  2030.         move.l    gad_tools_base,a6
  2031.         jsr    FreeGadgets(a6)        
  2032. free_gadgets_x:    rts
  2033.  
  2034.  
  2035. free_bit_maps:    tst.l    (a1)
  2036.         beq.s    no_bit_map
  2037.         move.l    (a1),a0
  2038.         clr.l    (a1)
  2039.         move.l    graphics_base,a6
  2040.         jsr    FreeBitMap(a6)
  2041. no_bit_map:    rts
  2042.  
  2043. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2044. ;        copy rast port
  2045. ;        INPUT:
  2046. ;        a0    = source.
  2047. ;        a1    = target.
  2048. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2049.  
  2050. copy_rast_port:    move.w    #rp_SIZEOF-1,d0
  2051. copy_rast_port_data:
  2052.         move.b    (a0)+,(a1)+
  2053.         dbra    d0,copy_rast_port_data
  2054.         rts
  2055.  
  2056. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2057. ;        free pens
  2058. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2059.  
  2060. free_pens_list:    lea    pen_list,a4
  2061.         move.l    (a4),pen_storage_list        ;save the pens.
  2062.         move.l    4(a4),pen_storage_list+4        
  2063.  
  2064.         move.l    pub_screen_lock,d0
  2065.         beq.s    no_pens
  2066.         move.l    d0,a5
  2067.         lea    sc_ViewPort(a5),a5
  2068.         move.l    vp_ColorMap(a5),a5
  2069.         move.l    graphics_base,a6
  2070.         moveq.l    #8-1,d7
  2071. free_pens:    moveq.l    #0,d0
  2072.         move.b    (a4)+,d0
  2073.         move.l    a5,a0
  2074.         jsr    ReleasePen(a6)
  2075.         dbra    d7,free_pens
  2076. no_pens:    rts
  2077.  
  2078. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2079. ;        init the colour box colours
  2080. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2081.  
  2082. copy_pens:    lea    colour_box_list,a0
  2083.         lea    pen_list,a1
  2084.         moveq.l    #8-1,d0
  2085.         moveq.l    #0,d1
  2086.         addq.l    #4*2,a0
  2087. copy_pen_box:    move.b    (a1)+,d1
  2088.         move.l    d1,(a0)+
  2089.         addq.l    #4*2,a0
  2090.         dbra    d0,copy_pen_box
  2091.         rts
  2092.  
  2093. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2094. ;        obtain pens for the bitmaps and convert the static
  2095. ;        images to use the obtained colours
  2096. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2097.  
  2098. obtain_pens_and_convert_gfx:
  2099.         move.l    graphics_base,a6
  2100.         move.l    pub_screen_lock,a5
  2101.         lea    sc_ViewPort(a5),a5
  2102.         move.l    vp_ColorMap(a5),a5
  2103.         lea    colours_dat,a4            ;input (r.B, g.B, b.B).
  2104.         lea    pen_list,a3            ;output (.B).
  2105.         moveq.l    #8-1,d7
  2106. obtain_pens:    move.l    a5,a0
  2107.         lea    obtain_pens_tag_list,a1
  2108.         moveq.l    #0,d1
  2109.         moveq.l    #0,d2
  2110.         moveq.l    #0,d3
  2111.         move.b    (a4)+,d1
  2112.         move.b    (a4)+,d2
  2113.         move.b    (a4)+,d3
  2114.         ror.l    #8,d1
  2115.         ror.l    #8,d2
  2116.         ror.l    #8,d3
  2117.         jsr    ObtainBestPenA(a6)
  2118.         move.b    d0,(a3)+
  2119.         dbra    d7,obtain_pens
  2120.  
  2121.         move.l    image_array_1,a0
  2122.         move.l    image_tmp_array_1,a1
  2123.         lea    pen_list,a2
  2124.         move.w    #(176*31)-1,d0
  2125.         moveq.l    #0,d1
  2126. convert_pens:    move.b    (a0)+,d1
  2127.         move.b    (a2,d1.l),(a1)+
  2128.         dbra    d0,convert_pens
  2129.  
  2130.         move.l    image_array_2,a0
  2131.         move.l    image_tmp_array_2,a1
  2132.         move.w    #(176*32)-1,d0
  2133. convert_pens_x:    move.b    (a0)+,d1
  2134.         move.b    (a2,d1.l),(a1)+
  2135.         dbra    d0,convert_pens_x
  2136.         rts
  2137.  
  2138. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2139. ;        init still map
  2140. ;        INPUT:
  2141. ;        a0    = map attributes.
  2142. ;        a1    = map.
  2143. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2144.  
  2145. init_still_map:    move.l    #176,d1
  2146.         moveq.l    #31,d2
  2147.         moveq.l    #3,d0
  2148.         lea    bm_Planes(a0),a2
  2149.         move.l    d1,d3
  2150.         lsr.w    #3,d3
  2151.         mulu.w    d2,d3                ;d3 = x/8*y.
  2152.         move.w    d0,d7
  2153.         subq.w    #1,d7
  2154. init_bit_map_xx:move.l    a1,(a2)+
  2155.         add.l    d3,a1
  2156.         dbra    d7,init_bit_map_xx
  2157.         jsr    InitBitMap(a6)
  2158.         rts
  2159.  
  2160. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2161. ;        draw a set of colour boxes
  2162. ;        a5    = colour box list.
  2163. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2164.  
  2165. draw_colour_list:
  2166.         move.l    (a5)+,d0
  2167.         beq.s    draw_colour_end
  2168.         move.l    (a5)+,d1
  2169.         move.l    (a5)+,d7
  2170.         bsr.b    draw_colour_box
  2171.         bra.s    draw_colour_list
  2172. draw_colour_end:rts
  2173.  
  2174. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2175. ;        draw a colour box
  2176. ;        INPUT:
  2177. ;        d0    = x.
  2178. ;        d1    = y.
  2179. ;        d7    = pen.
  2180. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2181.  
  2182. draw_colour_box:move.l    gad_tools_base,a6
  2183.         move.l    menu_ptr,a0
  2184.         move.l    wd_RPort(a0),a0
  2185.         lea    bevel_box_tagz,a1
  2186.         move.l    visual_info,4(a1)
  2187.         moveq.l    #26,d2
  2188.         moveq.l    #13,d3
  2189.         movem.l    d0/d1,-(SP)
  2190.         jsr    DrawBevelBoxA(a6)
  2191.  
  2192.         move.l    graphics_base,a6
  2193.         move.l    d7,d0
  2194.         move.l    d7,d1
  2195.         move.l    #RP_JAM1,d2
  2196.         move.l    menu_ptr,a1
  2197.         move.l    wd_RPort(a1),a1
  2198.         jsr    SetABPenDrMd(a6)
  2199.  
  2200.         movem.l    (SP)+,d0/d1
  2201.         move.l    d0,d2
  2202.         move.l    d1,d3
  2203.         add.l    #21,d2
  2204.         add.l    #10,d3
  2205.         addq.l    #4,d0
  2206.         addq.l    #2,d1
  2207.         move.l    menu_ptr,a1
  2208.         move.l    wd_RPort(a1),a1
  2209.         jsr    RectFill(a6)
  2210.         rts
  2211.  
  2212. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2213. ;        draw a set of bevel boxes
  2214. ;        INPUT:
  2215. ;        a5    = bevel box list.
  2216. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2217.  
  2218. draw_bevel_list:move.w    (a5)+,d0            ;x.
  2219.         beq.s    draw_bevel_end
  2220.         move.w    (a5)+,d1            ;y.
  2221.         move.w    (a5)+,d2            ;dx.
  2222.         move.w    (a5)+,d3            ;dy.
  2223.         bsr.b    draw_bevel_box
  2224.         bra.s    draw_bevel_list
  2225. draw_bevel_end:    rts
  2226.  
  2227. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2228. ;        draw a bevel box
  2229. ;        INPUT:
  2230. ;        d0    = x.
  2231. ;        d1    = y.
  2232. ;        d2    = dx.
  2233. ;        d3    = dy.
  2234. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2235.  
  2236. draw_bevel_box:    move.l    gad_tools_base,a6
  2237.         movem.l    d0-d3,-(SP)
  2238.  
  2239.         move.l    menu_ptr,a0
  2240.         move.l    wd_RPort(a0),a0
  2241.         lea    bevel_box_tags,a1
  2242.         move.l    visual_info,4(a1)
  2243.         jsr    DrawBevelBoxA(a6)
  2244.  
  2245.         movem.l    (SP)+,d0-d3
  2246.         movem.l    d0-d3,-(SP)
  2247.  
  2248.         move.l    menu_ptr,a0
  2249.         move.l    wd_RPort(a0),a0
  2250.         addq.l    #1,d0
  2251.         addq.l    #1,d1
  2252.         subq.l    #2,d2
  2253.         subq.l    #2,d3
  2254.         lea    bevel_box_tagz,a1
  2255.         move.l    visual_info,4(a1)
  2256.         jsr    DrawBevelBoxA(a6)
  2257.  
  2258.         move.l    graphics_base,a6
  2259.         movem.l    (SP)+,d0-d3
  2260.  
  2261.         move.l    menu_ptr,a0
  2262.         move.l    wd_RPort(a0),a1
  2263.         add.l    d0,d2
  2264.         add.l    d1,d3
  2265.         addq.l    #2,d0
  2266.         addq.l    #2,d1
  2267.         subq.l    #3,d2
  2268.         subq.l    #3,d3
  2269.         jsr    EraseRect(a6)
  2270.         rts
  2271.  
  2272. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2273. ;        join the directory and name into a single expression
  2274. ;        INPUT:
  2275. ;        a0    = output.
  2276. ;        a1    = name.
  2277. ;        a2    = the requester pointer.
  2278. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2279.  
  2280. parse_req_name:    move.l    rtfi_Dir(a2),a2
  2281.  
  2282.         moveq.l    #120,d0                ;max letters.
  2283.         tst.b    (a2)                ;current directory?
  2284.         beq.s    no_path_fix            ;yes. skip this part.
  2285. copy_path:    move.b    (a2)+,d1
  2286.         beq.s    exit_path            ;path is done.
  2287.         move.b    d1,(a0)+            ;output path.
  2288.         dbra    d0,copy_path            ;next letter.
  2289. ;        bra.s    exit_path            ;too many letters! quit!
  2290.  
  2291. exit_path:    cmp.b    #':',-1(a0)            ;device?
  2292.         beq.s    no_path_fix            ;yes. no need to fix the output.
  2293.         move.b    #'/',(a0)+            ;fixed the directory name.
  2294.  
  2295. no_path_fix:    moveq.l    #120,d0                ;max letters.
  2296. copy_name:    move.b    (a1)+,d1
  2297.         beq.s    exit_name            ;name is done.
  2298.         move.b    d1,(a0)+            ;output name.
  2299.         dbra    d0,copy_name            ;next letter.
  2300. ;        bra.s    exit_name            ;too many letters! quit!
  2301.  
  2302. exit_name:    clr.b    (a0)                ;end of file name.
  2303.         rts
  2304.  
  2305. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2306. ;        misc routines
  2307. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2308.  
  2309.         include    "routines/list_alloc_32bit.s"
  2310.  
  2311. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2312. ;        section    murrr,data
  2313. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2314.  
  2315. intuition_name:    dc.b    "intuition.library",0
  2316.         even
  2317. dos_name:    dc.b    "dos.library",0
  2318.         even
  2319. graphics_name:    dc.b    "graphics.library",0
  2320.         even
  2321. disk_font_name:    dc.b    "diskfont.library",0
  2322.         even
  2323.         even
  2324. req_tools_name:    dc.b    "reqtools.library",0
  2325.         even
  2326. gad_tools_name:    dc.b    "gadtools.library",0
  2327.         even
  2328.  
  2329. cli_or_wb:    dc.b    0
  2330. obtain_status_counter:
  2331.         dc.b    4
  2332.         even
  2333.  
  2334. list_of_areas_ptr:
  2335.         dc.l    0
  2336.  
  2337. exec_base:    dc.l    0
  2338. intuition_base:    dc.l    0
  2339. graphics_base:    dc.l    0
  2340. dos_base:    dc.l    0
  2341. disk_font_base:    dc.l    0
  2342. req_tools_base:    dc.l    0
  2343. gad_tools_base:    dc.l    0
  2344.  
  2345. chunky_to_planar_hardware:
  2346.         dc.l    0
  2347.  
  2348. file_info_ptr:    dc.l    0
  2349. file_data_ptr:    dc.l    0
  2350.  
  2351. pub_screen_lock:dc.l    0
  2352. visual_info:    dc.l    0
  2353. screen_font_y:    dc.l    0
  2354. menu_window_y:    dc.l    0
  2355.  
  2356. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2357. ;        font
  2358. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2359.  
  2360. font_ptr:    dc.l    0
  2361.  
  2362. font_attr:    dc.l    font_name
  2363.         dc.w    8                ;y.
  2364.         dc.b    0                ;style.
  2365. font_attr_flags:dc.b    32                ;flags (32 = proportional).
  2366.  
  2367. font_name:    dc.b    "wzonka.font",0
  2368.         even
  2369. another_name:    dc.b    "zapot.font",0
  2370.         even
  2371. res_font_name:    dc.b    "topaz.font",0
  2372.         even
  2373.  
  2374. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2375. ;        the req tools requester tag items and variables
  2376. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2377.  
  2378. rt_list:    dc.l    request_ptr_cfg
  2379.         dc.l    request_ptr_prefs
  2380.         dc.l    request_ptr_iff
  2381.         dc.l    0
  2382.  
  2383. request_ptr_cfg:dc.l    0                ;cfg file requester.
  2384. request_ptr_prefs:
  2385.         dc.l    0                ;prefs file requester.
  2386. request_ptr_iff:dc.l    0                ;iff file requester.
  2387.  
  2388. cfg_name:    dc.l    0
  2389. cfg_name_and_dir:
  2390.         dc.l    0
  2391. prefs_name:    dc.l    0
  2392. prefs_name_and_dir:
  2393.         dc.l    0
  2394. iff_name:    dc.l    0
  2395. iff_name_and_dir:
  2396.         dc.l    0
  2397.  
  2398. req_tags:    dc.l    RT_Window,0
  2399.         dc.l    RTFI_Flags,FREQF_PATGAD
  2400.         dc.l    TAG_END,0
  2401.  
  2402. req_change_tags:dc.l    RTFI_Dir,0
  2403.         dc.l    TAG_END,0
  2404.  
  2405. cfg_save_txt:    dc.b    "Save .cfg file",0
  2406.         even
  2407. cfg_load_txt:    dc.b    "Select .cfg file",0
  2408.         even
  2409. prefs_load_and_save_txt:
  2410.         dc.b    "Select .prefs file",0
  2411.         even
  2412. iff_load_txt:    dc.b    "Select .iff file",0
  2413.         even
  2414.  
  2415. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2416. ;        the memory allocation list
  2417. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2418.  
  2419. list_of_areas:    dc.l    back_pattern_map_attr,bm_SIZEOF,MEMF_PUBLIC
  2420.         dc.l    back_pattern_map,menu_x/8*menu_y*2,MEMF_CHIP
  2421.  
  2422.         dc.l    univ_gadget,gng_SIZEOF,MEMF_PUBLIC!MEMF_CLEAR
  2423.         dc.l    file_info_ptr,fib_SIZEOF,MEMF_PUBLIC!MEMF_CLEAR
  2424.         dc.l    colour_message,MN_SIZE+8*3,MEMF_PUBLIC!MEMF_CLEAR
  2425.         dc.l    colour_message_name,256,MEMF_PUBLIC!MEMF_CLEAR
  2426.         dc.l    file_info_ptr,fib_SIZEOF,MEMF_PUBLIC
  2427.  
  2428.         dc.l    cfg_name,256,MEMF_PUBLIC!MEMF_CLEAR
  2429.         dc.l    cfg_name_and_dir,256*2,MEMF_PUBLIC!MEMF_CLEAR
  2430.         dc.l    prefs_name,256,MEMF_PUBLIC!MEMF_CLEAR
  2431.         dc.l    prefs_name_and_dir,256,MEMF_PUBLIC!MEMF_CLEAR
  2432.         dc.l    iff_name,256,MEMF_PUBLIC!MEMF_CLEAR
  2433.         dc.l    iff_name_and_dir,256*2,MEMF_PUBLIC!MEMF_CLEAR
  2434.  
  2435.         dc.l    image_array_1,176*32,MEMF_PUBLIC
  2436.         dc.l    image_array_2,176*32,MEMF_PUBLIC
  2437.         dc.l    image_tmp_array_1,176*32,MEMF_PUBLIC
  2438.         dc.l    image_tmp_array_2,176*32,MEMF_PUBLIC
  2439.         dc.l    image_rast_port_1,rp_SIZEOF,MEMF_PUBLIC
  2440.         dc.l    image_rast_port_2,rp_SIZEOF,MEMF_PUBLIC
  2441.         dc.l    image_tmp_rast_port_1,rp_SIZEOF,MEMF_PUBLIC
  2442.         dc.l    image_tmp_rast_port_2,rp_SIZEOF,MEMF_PUBLIC
  2443.         dc.l    image_map_attr_1,bm_SIZEOF,MEMF_PUBLIC!MEMF_CLEAR
  2444.         dc.l    image_map_attr_2,bm_SIZEOF,MEMF_PUBLIC!MEMF_CLEAR
  2445.  
  2446.         dc.l    0
  2447.  
  2448. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2449. ;        universal window tags
  2450. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2451.  
  2452. win_tags_u:    dc.l    WA_NewLookMenus,TRUE
  2453.         dc.l    TAG_END,0            ;3d look, here too.
  2454.  
  2455. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2456. ;        menu window
  2457. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2458.  
  2459. menu_ptr:    dc.l    0
  2460.  
  2461. menu_window:    dc.w    0
  2462.         dc.w    11
  2463.         dc.w    menu_x
  2464.         dc.w    menu_y
  2465.         dc.b    0
  2466.         dc.b    1
  2467.         dc.l    menu_idcmp
  2468.         dc.l    menu_flags
  2469.         dc.l    0
  2470.         dc.l    0
  2471.         dc.l    menu_title
  2472.         dc.l    0
  2473.         dc.l    0
  2474.         dc.w    0
  2475.         dc.w    0
  2476.         dc.w    menu_x
  2477.         dc.w    menu_y
  2478.         dc.w    WBENCHSCREEN
  2479.  
  2480. menu_title:    dc.b    "Wzonka-Lad Palette Editor 1.10 (68020) © Ville Helin 1997-99",0
  2481.         even
  2482.  
  2483. univ_gadget:    dc.l    0
  2484.  
  2485. menu_b_1:    dc.l    0
  2486. menu_b_2:    dc.l    0
  2487. menu_b_3:    dc.l    0
  2488. menu_b_4:    dc.l    0
  2489. menu_b_5:    dc.l    0
  2490. menu_b_interpolate_background:
  2491.         dc.l    0
  2492. menu_b_interpolate_sprites:
  2493.         dc.l    0
  2494. menu_b_iff_load:dc.l    0
  2495.  
  2496. menu_b_copy_left_1:
  2497.         dc.l    0
  2498. menu_b_copy_left_2:
  2499.         dc.l    0
  2500. menu_b_copy_left_3:
  2501.         dc.l    0
  2502. menu_b_copy_left_4:
  2503.         dc.l    0
  2504. menu_b_copy_right_1:
  2505.         dc.l    0
  2506. menu_b_copy_right_2:
  2507.         dc.l    0
  2508. menu_b_copy_right_3:
  2509.         dc.l    0
  2510. menu_b_copy_right_4:
  2511.         dc.l    0
  2512.  
  2513. colour_1_r:    dc.l    0
  2514. colour_1_g:    dc.l    0
  2515. colour_1_b:    dc.l    0
  2516. colour_2_r:    dc.l    0
  2517. colour_2_g:    dc.l    0
  2518. colour_2_b:    dc.l    0
  2519. colour_3_r:    dc.l    0
  2520. colour_3_g:    dc.l    0
  2521. colour_3_b:    dc.l    0
  2522. colour_4_r:    dc.l    0
  2523. colour_4_g:    dc.l    0
  2524. colour_4_b:    dc.l    0
  2525. colour_5_r:    dc.l    0
  2526. colour_5_g:    dc.l    0
  2527. colour_5_b:    dc.l    0
  2528. colour_6_r:    dc.l    0
  2529. colour_6_g:    dc.l    0
  2530. colour_6_b:    dc.l    0
  2531. colour_7_r:    dc.l    0
  2532. colour_7_g:    dc.l    0
  2533. colour_7_b:    dc.l    0
  2534. colour_8_r:    dc.l    0
  2535. colour_8_g:    dc.l    0
  2536. colour_8_b:    dc.l    0
  2537.  
  2538. menu_load:    dc.b    "Load",0
  2539.         even
  2540. menu_save:    dc.b    "Save",0
  2541.         even
  2542. menu_obtain:    dc.b    "Obtain",0
  2543.         even
  2544. menu_interpolate:
  2545.         dc.b    "Interpolate",0
  2546.         even
  2547.  
  2548. colour_r:    dc.b    "R",0
  2549.         even
  2550. colour_g:    dc.b    "G",0
  2551.         even
  2552. colour_b:    dc.b    "B",0
  2553.         even
  2554.  
  2555. menu_copy_left:    dc.b    "<",0
  2556.         even
  2557. menu_copy_right:dc.b    ">",0
  2558.         even
  2559.  
  2560. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2561. ;        context gadgets
  2562. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2563.  
  2564. context_g_menu:    dc.l    0
  2565.  
  2566. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2567. ;        menu gadgets
  2568. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  2569.  
  2570. menu_scr_txt:    dc.b    "Wzonka-Lad Palette Editor 1.10",0
  2571.         even
  2572.  
  2573. menu_gadgets:    dc.w    180,50-font_y_sub
  2574.         dc.l    PLACETEXT_LEFT
  2575.         dc.l    colour_r
  2576.         dc.w    0
  2577.         dc.w    4                ;slider_kind!
  2578.         dc.w    100,8
  2579.         dc.l    slider_h_tags
  2580.         dc.l    colour_1_r
  2581.  
  2582.         dc.w    180,50+9-font_y_sub
  2583.         dc.l    PLACETEXT_LEFT
  2584.         dc.l    colour_g
  2585.         dc.w    1
  2586.         dc.w    4                ;slider_kind!
  2587.         dc.w    100,8
  2588.         dc.l    slider_h_tags
  2589.         dc.l    colour_1_g
  2590.  
  2591.         dc.w    180,50+9*2-font_y_sub
  2592.         dc.l    PLACETEXT_LEFT
  2593.         dc.l    colour_b
  2594.         dc.w    2
  2595.         dc.w    4                ;slider_kind!
  2596.         dc.w    100,8
  2597.         dc.l    slider_h_tags
  2598.         dc.l    colour_1_b
  2599.  
  2600.         dc.w    180,50+35-font_y_sub
  2601.         dc.l    PLACETEXT_LEFT
  2602.         dc.l    colour_r
  2603.         dc.w    3
  2604.         dc.w    4                ;slider_kind!
  2605.         dc.w    100,8
  2606.         dc.l    slider_h_tags
  2607.         dc.l    colour_2_r
  2608.  
  2609.         dc.w    180,50+9+35-font_y_sub
  2610.         dc.l    PLACETEXT_LEFT
  2611.         dc.l    colour_g
  2612.         dc.w    4
  2613.         dc.w    4                ;slider_kind!
  2614.         dc.w    100,8
  2615.         dc.l    slider_h_tags
  2616.         dc.l    colour_2_g
  2617.  
  2618.         dc.w    180,50+9*2+35-font_y_sub
  2619.         dc.l    PLACETEXT_LEFT
  2620.         dc.l    colour_b
  2621.         dc.w    5
  2622.         dc.w    4                ;slider_kind!
  2623.         dc.w    100,8
  2624.         dc.l    slider_h_tags
  2625.         dc.l    colour_2_b
  2626.  
  2627.         dc.w    180,50+35*2-font_y_sub
  2628.         dc.l    PLACETEXT_LEFT
  2629.         dc.l    colour_r
  2630.         dc.w    6
  2631.         dc.w    4                ;slider_kind!
  2632.         dc.w    100,8
  2633.         dc.l    slider_h_tags
  2634.         dc.l    colour_3_r
  2635.  
  2636.         dc.w    180,50+9+35*2-font_y_sub
  2637.         dc.l    PLACETEXT_LEFT
  2638.         dc.l    colour_g
  2639.         dc.w    7
  2640.         dc.w    4                ;slider_kind!
  2641.         dc.w    100,8
  2642.         dc.l    slider_h_tags
  2643.         dc.l    colour_3_g
  2644.  
  2645.         dc.w    180,50+9*2+35*2-font_y_sub
  2646.         dc.l    PLACETEXT_LEFT
  2647.         dc.l    colour_b
  2648.         dc.w    8
  2649.         dc.w    4                ;slider_kind!
  2650.         dc.w    100,8
  2651.         dc.l    slider_h_tags
  2652.         dc.l    colour_3_b
  2653.  
  2654.         dc.w    180,50+35*3-font_y_sub
  2655.         dc.l    PLACETEXT_LEFT
  2656.         dc.l    colour_r
  2657.         dc.w    9
  2658.         dc.w    4                ;slider_kind!
  2659.         dc.w    100,8
  2660.         dc.l    slider_h_tags
  2661.         dc.l    colour_4_r
  2662.  
  2663.         dc.w    180,50+9+35*3-font_y_sub
  2664.         dc.l    PLACETEXT_LEFT
  2665.         dc.l    colour_g
  2666.         dc.w    10
  2667.         dc.w    4                ;slider_kind!
  2668.         dc.w    100,8
  2669.         dc.l    slider_h_tags
  2670.         dc.l    colour_4_g
  2671.  
  2672.         dc.w    180,50+9*2+35*3-font_y_sub
  2673.         dc.l    PLACETEXT_LEFT
  2674.         dc.l    colour_b
  2675.         dc.w    11
  2676.         dc.w    4                ;slider_kind!
  2677.         dc.w    100,8
  2678.         dc.l    slider_h_tags
  2679.         dc.l    colour_4_b
  2680.  
  2681.         dc.w    410,50-font_y_sub
  2682.         dc.l    PLACETEXT_LEFT
  2683.         dc.l    colour_r
  2684.         dc.w    12
  2685.         dc.w    4                ;slider_kind!
  2686.         dc.w    100,8
  2687.         dc.l    slider_h_tags
  2688.         dc.l    colour_5_r
  2689.  
  2690.         dc.w    410,50+9-font_y_sub
  2691.         dc.l    PLACETEXT_LEFT
  2692.         dc.l    colour_g
  2693.         dc.w    13
  2694.         dc.w    4                ;slider_kind!
  2695.         dc.w    100,8
  2696.         dc.l    slider_h_tags
  2697.         dc.l    colour_5_g
  2698.  
  2699.         dc.w    410,50+9*2-font_y_sub
  2700.         dc.l    PLACETEXT_LEFT
  2701.         dc.l    colour_b
  2702.         dc.w    14
  2703.         dc.w    4                ;slider_kind!
  2704.         dc.w    100,8
  2705.         dc.l    slider_h_tags
  2706.         dc.l    colour_5_b
  2707.  
  2708.         dc.w    410,50+35-font_y_sub
  2709.         dc.l    PLACETEXT_LEFT
  2710.         dc.l    colour_r
  2711.         dc.w    15
  2712.         dc.w    4                ;slider_kind!
  2713.         dc.w    100,8
  2714.         dc.l    slider_h_tags
  2715.         dc.l    colour_6_r
  2716.  
  2717.         dc.w    410,50+9+35-font_y_sub
  2718.         dc.l    PLACETEXT_LEFT
  2719.         dc.l    colour_g
  2720.         dc.w    16
  2721.         dc.w    4                ;slider_kind!
  2722.         dc.w    100,8
  2723.         dc.l    slider_h_tags
  2724.         dc.l    colour_6_g
  2725.  
  2726.         dc.w    410,50+9*2+35-font_y_sub
  2727.         dc.l    PLACETEXT_LEFT
  2728.         dc.l    colour_b
  2729.         dc.w    17
  2730.         dc.w    4                ;slider_kind!
  2731.         dc.w    100,8
  2732.         dc.l    slider_h_tags
  2733.         dc.l    colour_6_b
  2734.  
  2735.         dc.w    410,50+35*2-font_y_sub
  2736.         dc.l    PLACETEXT_LEFT
  2737.         dc.l    colour_r
  2738.         dc.w    18
  2739.         dc.w    4                ;slider_kind!
  2740.         dc.w    100,8
  2741.         dc.l    slider_h_tags
  2742.         dc.l    colour_7_r
  2743.  
  2744.         dc.w    410,50+9+35*2-font_y_sub
  2745.         dc.l    PLACETEXT_LEFT
  2746.         dc.l    colour_g
  2747.         dc.w    19
  2748.         dc.w    4                ;slider_kind!
  2749.         dc.w    100,8
  2750.         dc.l    slider_h_tags
  2751.         dc.l    colour_7_g
  2752.  
  2753.         dc.w    410,50+9*2+35*2-font_y_sub
  2754.         dc.l    PLACETEXT_LEFT
  2755.         dc.l    colour_b
  2756.         dc.w    20
  2757.         dc.w    4                ;slider_kind!
  2758.         dc.w    100,8
  2759.         dc.l    slider_h_tags
  2760.         dc.l    colour_7_b
  2761.  
  2762.         dc.w    410,50+35*3-font_y_sub
  2763.         dc.l    PLACETEXT_LEFT
  2764.         dc.l    colour_r
  2765.         dc.w    21
  2766.         dc.w    4                ;slider_kind!
  2767.         dc.w    100,8
  2768.         dc.l    slider_h_tags
  2769.         dc.l    colour_8_r
  2770.  
  2771.         dc.w    410,50+9+35*3-font_y_sub
  2772.         dc.l    PLACETEXT_LEFT
  2773.         dc.l    colour_g
  2774.         dc.w    22
  2775.         dc.w    4                ;slider_kind!
  2776.         dc.w    100,8
  2777.         dc.l    slider_h_tags
  2778.         dc.l    colour_8_g
  2779.  
  2780.         dc.w    410,50+9*2+35*3-font_y_sub
  2781.         dc.l    PLACETEXT_LEFT
  2782.         dc.l    colour_b
  2783.         dc.w    23
  2784.         dc.w    4                ;slider_kind!
  2785.         dc.w    100,8
  2786.         dc.l    slider_h_tags
  2787.         dc.l    colour_8_b
  2788.  
  2789.         dc.w    30+gadgets_x,40+gadgets_y-font_y_sub+iff_y
  2790.         dc.l    PLACETEXT_IN
  2791.         dc.l    menu_load
  2792.         dc.w    24
  2793.         dc.w    0                ;button_kind!
  2794.         dc.w    60,14
  2795.         dc.l    menu_b_1
  2796.  
  2797.         dc.w    30+gadgets_x,40+15+gadgets_y-font_y_sub+iff_y
  2798.         dc.l    PLACETEXT_IN
  2799.         dc.l    menu_save
  2800.         dc.w    25
  2801.         dc.w    0                ;button_kind!
  2802.         dc.w    60,14
  2803.         dc.l    menu_b_2
  2804.  
  2805.         dc.w    30+gadgets_x,89+gadgets_y-font_y_sub+iff_y
  2806.         dc.l    PLACETEXT_IN
  2807.         dc.l    menu_load
  2808.         dc.w    26
  2809.         dc.w    0                ;button_kind!
  2810.         dc.w    60,14
  2811.         dc.l    menu_b_3
  2812.  
  2813.         dc.w    30+gadgets_x,89+15+gadgets_y-font_y_sub+iff_y
  2814.         dc.l    PLACETEXT_IN
  2815.         dc.l    menu_save
  2816.         dc.w    27
  2817.         dc.w    0                ;button_kind!
  2818.         dc.w    60,14
  2819.         dc.l    menu_b_4
  2820.  
  2821.         dc.w    30+gadgets_x,138+gadgets_y-font_y_sub+iff_y
  2822.         dc.l    PLACETEXT_IN
  2823.         dc.l    menu_obtain
  2824.         dc.w    28
  2825.         dc.w    0                ;button_kind!
  2826.         dc.w    60,14
  2827.         dc.l    menu_b_5
  2828.  
  2829.         dc.w    405,26-font_y_sub
  2830.         dc.l    PLACETEXT_IN
  2831.         dc.l    menu_interpolate
  2832.         dc.w    29
  2833.         dc.w    0                ;button_kind!
  2834.         dc.w    110,14
  2835.         dc.l    menu_b_interpolate_sprites
  2836.  
  2837.         dc.w    175,26-font_y_sub
  2838.         dc.l    PLACETEXT_IN
  2839.         dc.l    menu_interpolate
  2840.         dc.w    30
  2841.         dc.w    0                ;button_kind!
  2842.         dc.w    110,14
  2843.         dc.l    menu_b_interpolate_background
  2844.  
  2845.         dc.w    321,57-font_y_sub
  2846.         dc.l    PLACETEXT_IN
  2847.         dc.l    menu_copy_left
  2848.         dc.w    31
  2849.         dc.w    0                ;button_kind!
  2850.         dc.w    14,11
  2851.         dc.l    menu_b_copy_left_1
  2852.  
  2853.         dc.w    335,57-font_y_sub
  2854.         dc.l    PLACETEXT_IN
  2855.         dc.l    menu_copy_right
  2856.         dc.w    32
  2857.         dc.w    0                ;button_kind!
  2858.         dc.w    14,11
  2859.         dc.l    menu_b_copy_right_1
  2860.  
  2861.         dc.w    321,57+35-font_y_sub
  2862.         dc.l    PLACETEXT_IN
  2863.         dc.l    menu_copy_left
  2864.         dc.w    33
  2865.         dc.w    0                ;button_kind!
  2866.         dc.w    14,11
  2867.         dc.l    menu_b_copy_left_2
  2868.  
  2869.         dc.w    335,57+35-font_y_sub
  2870.         dc.l    PLACETEXT_IN
  2871.         dc.l    menu_copy_right
  2872.         dc.w    34
  2873.         dc.w    0                ;button_kind!
  2874.         dc.w    14,11
  2875.         dc.l    menu_b_copy_right_2
  2876.  
  2877.         dc.w    321,57+35*2-font_y_sub
  2878.         dc.l    PLACETEXT_IN
  2879.         dc.l    menu_copy_left
  2880.         dc.w    35
  2881.         dc.w    0                ;button_kind!
  2882.         dc.w    14,11
  2883.         dc.l    menu_b_copy_left_3
  2884.  
  2885.         dc.w    335,57+35*2-font_y_sub
  2886.         dc.l    PLACETEXT_IN
  2887.         dc.l    menu_copy_right
  2888.         dc.w    36
  2889.         dc.w    0                ;button_kind!
  2890.         dc.w    14,11
  2891.         dc.l    menu_b_copy_right_3
  2892.  
  2893.         dc.w    321,57+35*3-font_y_sub
  2894.         dc.l    PLACETEXT_IN
  2895.         dc.l    menu_copy_left
  2896.         dc.w    37
  2897.         dc.w    0                ;button_kind!
  2898.         dc.w    14,11
  2899.         dc.l    menu_b_copy_left_4
  2900.  
  2901.         dc.w    335,57+35*3-font_y_sub
  2902.         dc.l    PLACETEXT_IN
  2903.         dc.l    menu_copy_right
  2904.         dc.w    38
  2905.         dc.w    0                ;button_kind!
  2906.         dc.w    14,11
  2907.         dc.l    menu_b_copy_right_4
  2908.  
  2909.         dc.w    30+gadgets_x,6+gadgets_y-font_y_sub+iff_y
  2910.         dc.l    PLACETEXT_IN
  2911.         dc.l    menu_load
  2912.         dc.w    39
  2913.         dc.w    0                ;button_kind!
  2914.         dc.w    60,14
  2915.         dc.l    menu_b_iff_load
  2916.  
  2917.         dc.l    0                ;end of the list.
  2918.  
  2919. slider_h_tags:    dc.l    GTSL_Level,0
  2920.         dc.l    GTSL_Min,0
  2921.         dc.l    GTSL_Max,255
  2922.         dc.l    GTSL_LevelPlace,PLACETEXT_RIGHT
  2923.         dc.l    GTSL_Justification,GTJ_LEFT
  2924.         dc.l    GTSL_MaxLevelLen,3
  2925.         dc.l    GTSL_LevelFormat,level_format
  2926.         dc.l    PGA_Freedom,LORIENT_HORIZ
  2927.         dc.l    TAG_END,0
  2928.  
  2929. level_format:    dc.b    "%ld",0
  2930.         even
  2931.  
  2932. menu_item_text_1:
  2933.         dc.b    2
  2934.         dc.b    0
  2935.         dc.b    0
  2936.         dc.b    0
  2937.         dc.w    30+gadgets_x+10
  2938.         dc.w    40+gadgets_y-13-font_y_sub+iff_y
  2939.         dc.l    font_attr
  2940.         dc.l    menu_item_txt_1
  2941.         dc.l    menu_item_text_2
  2942.  
  2943. menu_item_text_2:
  2944.         dc.b    2
  2945.         dc.b    0
  2946.         dc.b    0
  2947.         dc.b    0
  2948.         dc.w    30+gadgets_x+18
  2949.         dc.w    89+gadgets_y-13-font_y_sub+iff_y
  2950.         dc.l    font_attr
  2951.         dc.l    menu_item_txt_2
  2952.         dc.l    menu_item_text_3
  2953.  
  2954. menu_item_text_3:
  2955.         dc.b    2
  2956.         dc.b    0
  2957.         dc.b    0
  2958.         dc.b    0
  2959.         dc.w    30+gadgets_x-4
  2960.         dc.w    138+gadgets_y-13-font_y_sub+iff_y
  2961.         dc.l    font_attr
  2962.         dc.l    menu_item_txt_3
  2963.         dc.l    menu_item_text_4
  2964.  
  2965. menu_item_text_4:
  2966.         dc.b    2
  2967.         dc.b    0
  2968.         dc.b    0
  2969.         dc.b    0
  2970.         dc.w    160
  2971.         dc.w    21-8-font_y_sub
  2972.         dc.l    font_attr
  2973.         dc.l    menu_item_txt_4
  2974.         dc.l    menu_item_text_5
  2975.  
  2976. menu_item_text_5:
  2977.         dc.b    2
  2978.         dc.b    0
  2979.         dc.b    0
  2980.         dc.b    0
  2981.         dc.w    410
  2982.         dc.w    21-8-font_y_sub
  2983.         dc.l    font_attr
  2984.         dc.l    menu_item_txt_5
  2985.         dc.l    menu_item_text_6
  2986.  
  2987. menu_item_text_6:
  2988.         dc.b    2
  2989.         dc.b    0
  2990.         dc.b    0
  2991.         dc.b    0
  2992.         dc.w    230
  2993.         dc.w    50-8-font_y_sub
  2994.         dc.l    font_attr
  2995.         dc.l    menu_colour_1
  2996.         dc.l    menu_item_text_7
  2997.  
  2998. menu_item_text_7:
  2999.         dc.b    2
  3000.         dc.b    0
  3001.         dc.b    0
  3002.         dc.b    0
  3003.         dc.w    230
  3004.         dc.w    50+35-8-font_y_sub
  3005.         dc.l    font_attr
  3006.         dc.l    menu_colour_2
  3007.         dc.l    menu_item_text_8
  3008.  
  3009. menu_item_text_8:
  3010.         dc.b    2
  3011.         dc.b    0
  3012.         dc.b    0
  3013.         dc.b    0
  3014.         dc.w    230
  3015.         dc.w    50+35*2-8-font_y_sub
  3016.         dc.l    font_attr
  3017.         dc.l    menu_colour_3
  3018.         dc.l    menu_item_text_9
  3019.  
  3020. menu_item_text_9:
  3021.         dc.b    2
  3022.         dc.b    0
  3023.         dc.b    0
  3024.         dc.b    0
  3025.         dc.w    230
  3026.         dc.w    50+35*3-8-font_y_sub
  3027.         dc.l    font_attr
  3028.         dc.l    menu_colour_4
  3029.         dc.l    menu_item_text_10
  3030.  
  3031. menu_item_text_10:
  3032.         dc.b    2
  3033.         dc.b    0
  3034.         dc.b    0
  3035.         dc.b    0
  3036.         dc.w    460
  3037.         dc.w    50-8-font_y_sub
  3038.         dc.l    font_attr
  3039.         dc.l    menu_colour_1
  3040.         dc.l    menu_item_text_11
  3041.  
  3042. menu_item_text_11:
  3043.         dc.b    2
  3044.         dc.b    0
  3045.         dc.b    0
  3046.         dc.b    0
  3047.         dc.w    460
  3048.         dc.w    50+35-8-font_y_sub
  3049.         dc.l    font_attr
  3050.         dc.l    menu_colour_2
  3051.         dc.l    menu_item_text_12
  3052.  
  3053. menu_item_text_12:
  3054.         dc.b    2
  3055.         dc.b    0
  3056.         dc.b    0
  3057.         dc.b    0
  3058.         dc.w    460
  3059.         dc.w    50+35*2-8-font_y_sub
  3060.         dc.l    font_attr
  3061.         dc.l    menu_colour_3
  3062.         dc.l    menu_item_text_13
  3063.  
  3064. menu_item_text_13:
  3065.         dc.b    2
  3066.         dc.b    0
  3067.         dc.b    0
  3068.         dc.b    0
  3069.         dc.w    460
  3070.         dc.w    50+35*3-8-font_y_sub
  3071.         dc.l    font_attr
  3072.         dc.l    menu_colour_4
  3073.         dc.l    menu_item_text_14
  3074.  
  3075. menu_item_text_14:
  3076.         dc.b    2
  3077.         dc.b    0
  3078.         dc.b    0
  3079.         dc.b    0
  3080.         dc.w    52
  3081.         dc.w    38-font_y_sub
  3082.         dc.l    font_attr
  3083.         dc.l    menu_item_txt_6
  3084.         dc.l    0
  3085.  
  3086. menu_item_txt_1:dc.b    ".prefs",0
  3087.         even
  3088. menu_item_txt_2:dc.b    ".cfg",0
  3089.         even
  3090. menu_item_txt_3:dc.b    "Wzonka-Lad",0
  3091.         even
  3092. menu_item_txt_4:dc.b    "Background colours",0
  3093.         even
  3094. menu_item_txt_5:dc.b    "Sprite colours",0
  3095.         even
  3096. menu_item_txt_6:dc.b    ".iff",0
  3097.         even
  3098.  
  3099. menu_colour_1:    dc.b    "1",0
  3100.         even
  3101. menu_colour_2:    dc.b    "2",0
  3102.         even
  3103. menu_colour_3:    dc.b    "3",0
  3104.         even
  3105. menu_colour_4:    dc.b    "4",0
  3106.         even
  3107.  
  3108. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3109. ;        bitmaps
  3110. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3111.  
  3112. back_pattern_map_attr:
  3113.         dc.l    0
  3114.  
  3115. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3116. ;        the version string
  3117. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3118.  
  3119. version_data:    dc.b    "$VER: Wzonka-Lad Palette Editor 1.10 (25.05.99)",0
  3120.         even
  3121.  
  3122. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3123. ;        bevel box lists
  3124. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3125.  
  3126. menu_bevel_list:dc.w    22+gadgets_x,35+iff_y+gadgets_y-font_y_sub,76,39
  3127.         dc.w    22+gadgets_x,84+iff_y+gadgets_y-font_y_sub,76,39
  3128.         dc.w    22+gadgets_x,133+iff_y+gadgets_y-font_y_sub,76,24
  3129.         dc.w    22+gadgets_x,21+gadgets_y-font_y_sub,76,24
  3130.  
  3131.         dc.w    120,21-font_y_sub,200,200
  3132.         dc.w    350,21-font_y_sub,200,200
  3133.         dc.w    0
  3134.  
  3135. bevel_box_tags:    dc.l    GT_VisualInfo,0
  3136.         dc.l    GTBB_Recessed,TRUE
  3137.         dc.l    GTBB_FrameType,BBFT_BUTTON
  3138.         dc.l    TAG_END,0
  3139.  
  3140. bevel_box_tagz:    dc.l    GT_VisualInfo,0
  3141.         dc.l    GTBB_FrameType,BBFT_BUTTON
  3142.         dc.l    TAG_END,0
  3143.  
  3144. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3145. ;        window graphics
  3146. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3147.  
  3148. back_pattern_bn:incbin    "windows/pattern.bn"
  3149.         even
  3150.  
  3151. back_pattern_map:
  3152.         dc.l    0
  3153.  
  3154. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3155. ;        message port
  3156. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3157.  
  3158. message_port:    dc.l    0
  3159. message_port_name:
  3160.         dc.b    "Wzonka-Lad Palette Editor Port",0
  3161.         even
  3162.  
  3163. message_port_wzonka_lad:
  3164.         dc.l    0
  3165. message_port_wzonka_lad_name:
  3166.         dc.b    "Wzonka-Lad Port",0
  3167.         even
  3168.  
  3169. obtain_gadget_status:
  3170.         dc.l    0                ;0 = on / 1 = off.
  3171. colour_message:    dc.l    0
  3172. colour_message_name:
  3173.         dc.l    0
  3174.  
  3175. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3176. ;        read pixel array
  3177. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3178.  
  3179. image_array_1:    dc.l    0
  3180. image_array_2:    dc.l    0
  3181. image_map_attr_1:
  3182.         dc.l    0
  3183. image_map_attr_2:
  3184.         dc.l    0
  3185. image_rast_port_1:
  3186.         dc.l    0
  3187. image_rast_port_2:
  3188.         dc.l    0
  3189.  
  3190. image_tmp_array_1:
  3191.         dc.l    0
  3192. image_tmp_array_2:
  3193.         dc.l    0
  3194. image_tmp_map_attr_1:
  3195.         dc.l    0
  3196. image_tmp_rast_port_1:
  3197.         dc.l    0
  3198. image_tmp_map_attr_2:
  3199.         dc.l    0
  3200. image_tmp_rast_port_2:
  3201.         dc.l    0
  3202.  
  3203. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3204. ;        obtain pens
  3205. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3206.  
  3207. obtain_pens_tag_list:
  3208.         dc.l    OBP_Precision,PRECISION_IMAGE
  3209.         dc.l    OBP_FailIfBad,FALSE
  3210.         dc.l    TAG_END,0
  3211. gameboy_colours:incbin    "data/gameboy_colours.pal"
  3212.         even
  3213. pen_list:    ds.b    8
  3214. pen_storage_list:
  3215.         ds.b    8
  3216.  
  3217. conversion_occurred:
  3218.         dc.l    0
  3219.  
  3220. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3221. ;        colours
  3222. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3223.  
  3224. colours_dat:    ds.b    8*3
  3225.         even
  3226.  
  3227. get_gadget_attrs_tag_list:
  3228.         dc.l    GTSL_Level,get_gadget_attrs_tag_return
  3229.         dc.l    TAG_END,0
  3230.  
  3231. get_gadget_attrs_tag_return:
  3232.         dc.l    0
  3233.  
  3234. set_gadget_attrs_tag_list:
  3235.         dc.l    GTSL_Level,0
  3236.         dc.l    TAG_END,0
  3237.  
  3238. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3239. ;        list of colour boxes
  3240. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3241.  
  3242. colour_box_list:dc.l    130,56-font_y_sub,0
  3243.         dc.l    130,56-font_y_sub+35*1,1
  3244.         dc.l    130,56-font_y_sub+35*2,2
  3245.         dc.l    130,56-font_y_sub+35*3,3
  3246.         dc.l    360,56-font_y_sub,4
  3247.         dc.l    360,56-font_y_sub+35*1,5
  3248.         dc.l    360,56-font_y_sub+35*2,6
  3249.         dc.l    360,56-font_y_sub+35*3,7
  3250.         dc.l    0
  3251.  
  3252. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3253. ;        input / output .cfg file
  3254. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3255.  
  3256. cfg_colour_id_list_position:
  3257.         dc.l    0,3,6,9
  3258.         dc.l    0,3,6,9
  3259.  
  3260.         dc.l    0,3,6,9
  3261.         dc.l    0,3,6,9
  3262.         dc.l    0,3,6,9
  3263.  
  3264.         dc.l    12,15,18,21
  3265.         dc.l    12,15,18,21
  3266.  
  3267. cfg_colour_id_list_long_names:
  3268.         dc.l    cfg_wc_0
  3269.         dc.l    cfg_wc_1
  3270.         dc.l    cfg_wc_2
  3271.         dc.l    cfg_wc_3
  3272.  
  3273.         dc.l    cfg_windowcolor_0
  3274.         dc.l    cfg_windowcolor_1
  3275.         dc.l    cfg_windowcolor_2
  3276.         dc.l    cfg_windowcolor_3
  3277.  
  3278.         dc.l    cfg_c_0
  3279.         dc.l    cfg_c_1
  3280.         dc.l    cfg_c_2
  3281.         dc.l    cfg_c_3
  3282.  
  3283.         dc.l    cfg_bc_0
  3284.         dc.l    cfg_bc_1
  3285.         dc.l    cfg_bc_2
  3286.         dc.l    cfg_bc_3
  3287.  
  3288.         dc.l    cfg_backgroundcolor_0
  3289.         dc.l    cfg_backgroundcolor_1
  3290.         dc.l    cfg_backgroundcolor_2
  3291.         dc.l    cfg_backgroundcolor_3
  3292.  
  3293.         dc.l    cfg_sc_0
  3294.         dc.l    cfg_sc_1
  3295.         dc.l    cfg_sc_2
  3296.         dc.l    cfg_sc_3
  3297.  
  3298.         dc.l    cfg_spritecolor_0
  3299.         dc.l    cfg_spritecolor_1
  3300.         dc.l    cfg_spritecolor_2
  3301.         dc.l    cfg_spritecolor_3
  3302.  
  3303. cfg_c_0:    dc.b    "-c0",0
  3304.         even
  3305. cfg_c_1:    dc.b    "-c1",0
  3306.         even
  3307. cfg_c_2:    dc.b    "-c2",0
  3308.         even
  3309. cfg_c_3:    dc.b    "-c3",0
  3310.         even
  3311.  
  3312. cfg_wc_0:    dc.b    "-wc0",0
  3313.         even
  3314. cfg_wc_1:    dc.b    "-wc1",0
  3315.         even
  3316. cfg_wc_2:    dc.b    "-wc2",0
  3317.         even
  3318. cfg_wc_3:    dc.b    "-wc3",0
  3319.         even
  3320.  
  3321. cfg_bc_0:    dc.b    "-bc0",0
  3322.         even
  3323. cfg_bc_1:    dc.b    "-bc1",0
  3324.         even
  3325. cfg_bc_2:    dc.b    "-bc2",0
  3326.         even
  3327. cfg_bc_3:    dc.b    "-bc3",0
  3328.         even
  3329.  
  3330. cfg_sc_0:    dc.b    "-sc0",0
  3331.         even
  3332. cfg_sc_1:    dc.b    "-sc1",0
  3333.         even
  3334. cfg_sc_2:    dc.b    "-sc2",0
  3335.         even
  3336. cfg_sc_3:    dc.b    "-sc3",0
  3337.         even
  3338.  
  3339. cfg_windowcolor_0:
  3340.         dc.b    "-windowcolor0",0
  3341.         even
  3342. cfg_windowcolor_1:
  3343.         dc.b    "-windowcolor1",0
  3344.         even
  3345. cfg_windowcolor_2:
  3346.         dc.b    "-windowcolor2",0
  3347.         even
  3348. cfg_windowcolor_3:
  3349.         dc.b    "-windowcolor3",0
  3350.         even
  3351.  
  3352. cfg_backgroundcolor_0:
  3353.         dc.b    "-backgroundcolor0",0
  3354.         even
  3355. cfg_backgroundcolor_1:
  3356.         dc.b    "-backgroundcolor1",0
  3357.         even
  3358. cfg_backgroundcolor_2:
  3359.         dc.b    "-backgroundcolor2",0
  3360.         even
  3361. cfg_backgroundcolor_3:
  3362.         dc.b    "-backgroundcolor3",0
  3363.         even
  3364.  
  3365. cfg_spritecolor_0:
  3366.         dc.b    "-spritecolor0",0
  3367.         even
  3368. cfg_spritecolor_1:
  3369.         dc.b    "-spritecolor1",0
  3370.         even
  3371. cfg_spritecolor_2:
  3372.         dc.b    "-spritecolor2",0
  3373.         even
  3374. cfg_spritecolor_3:
  3375.         dc.b    "-spritecolor3",0
  3376.         even
  3377.  
  3378. cfg_colours_output:
  3379.         dc.l    cfg_save_win_0
  3380.         dc.l    cfg_save_win_1
  3381.         dc.l    cfg_save_win_2
  3382.         dc.l    cfg_save_win_3
  3383.  
  3384.         dc.l    cfg_save_bg_0
  3385.         dc.l    cfg_save_bg_1
  3386.         dc.l    cfg_save_bg_2
  3387.         dc.l    cfg_save_bg_3
  3388.  
  3389.         dc.l    cfg_save_spr_0
  3390.         dc.l    cfg_save_spr_1
  3391.         dc.l    cfg_save_spr_2
  3392.         dc.l    cfg_save_spr_3
  3393.  
  3394. cfg_save_file:
  3395.         dc.b    "-sc0 #"
  3396. cfg_save_spr_0:    ds.b    6
  3397.         dc.b    $A
  3398.         dc.b    "-sc1 #"
  3399. cfg_save_spr_1:    ds.b    6
  3400.         dc.b    $A
  3401.         dc.b    "-sc2 #"
  3402. cfg_save_spr_2:    ds.b    6
  3403.         dc.b    $A
  3404.         dc.b    "-sc3 #"
  3405. cfg_save_spr_3:    ds.b    6
  3406.         dc.b    $A
  3407.         dc.b    "-wc0 #"
  3408. cfg_save_win_0:    ds.b    6
  3409.         dc.b    $A
  3410.         dc.b    "-wc1 #"
  3411. cfg_save_win_1:    ds.b    6
  3412.         dc.b    $A
  3413.         dc.b    "-wc2 #"
  3414. cfg_save_win_2:    ds.b    6
  3415.         dc.b    $A
  3416.         dc.b    "-wc3 #"
  3417. cfg_save_win_3:    ds.b    6
  3418.         dc.b    $A
  3419.         dc.b    "-bc0 #"
  3420. cfg_save_bg_0:    ds.b    6
  3421.         dc.b    $A
  3422.         dc.b    "-bc1 #"
  3423. cfg_save_bg_1:    ds.b    6
  3424.         dc.b    $A
  3425.         dc.b    "-bc2 #"
  3426. cfg_save_bg_2:    ds.b    6
  3427.         dc.b    $A
  3428.         dc.b    "-bc3 #"
  3429. cfg_save_bg_3:    ds.b    6
  3430.         dc.b    $A
  3431. cfg_save_file_end:
  3432.         even
  3433.  
  3434. vgb_colours:    dc.l    vgb_c1
  3435.         dc.l    vgb_c2
  3436.         dc.l    vgb_c3
  3437.         dc.l    vgb_c4
  3438.         dc.l    vgb_c5
  3439.         dc.l    vgb_c6
  3440.         dc.l    vgb_c7
  3441.         dc.l    vgb_c8
  3442.         dc.l    vgb_c9
  3443.         dc.l    vgb_c10
  3444.         dc.l    vgb_c11
  3445.         dc.l    vgb_c12
  3446.         dc.l    vgb_c13
  3447.         dc.l    vgb_c14
  3448.         dc.l    vgb_c15
  3449.         dc.l    vgb_c16
  3450.         dc.l    vgb_c17
  3451.         dc.l    vgb_c18
  3452.         dc.l    vgb_c19
  3453.         dc.l    0
  3454.  
  3455. vgb_colours_h:    dc.b    255,255,0
  3456.         dc.b    0,255,0
  3457.         dc.b    165,82,0
  3458.         dc.b    0,0,0
  3459.         dc.b    85,255,255
  3460.         dc.b    255,0,0
  3461.         dc.b    255,255,255
  3462.         dc.b    255,165,165
  3463.         dc.b    0,0,255
  3464.         dc.b    0,165,165
  3465.         dc.b    255,115,8
  3466.         dc.b    255,82,255
  3467.         dc.b    165,0,165
  3468.         dc.b    0,165,165
  3469.         dc.b    0,165,0
  3470.         dc.b    165,0,0
  3471.         dc.b    0,0,165
  3472.         dc.b    165,165,165
  3473.         dc.b    82,82,82
  3474.  
  3475. vgb_c1:        dc.b    "yellow",0
  3476.         even
  3477. vgb_c2:        dc.b    "green",0
  3478.         even
  3479. vgb_c3:        dc.b    "brown",0
  3480.         even
  3481. vgb_c4:        dc.b    "black",0
  3482.         even
  3483. vgb_c5:        dc.b    "cyan",0
  3484.         even
  3485. vgb_c6:        dc.b    "red",0
  3486.         even
  3487. vgb_c7:        dc.b    "white",0
  3488.         even
  3489. vgb_c8:        dc.b    "pink",0
  3490.         even
  3491. vgb_c9:        dc.b    "blue",0
  3492.         even
  3493. vgb_c10:    dc.b    "dkcyan",0
  3494.         even
  3495. vgb_c11:    dc.b    "orange",0
  3496.         even
  3497. vgb_c12:    dc.b    "magenta",0
  3498.         even
  3499. vgb_c13:    dc.b    "dkmagenta",0
  3500.         even
  3501. vgb_c14:    dc.b    "dkcyan",0
  3502.         even
  3503. vgb_c15:    dc.b    "dkgreen",0
  3504.         even
  3505. vgb_c16:    dc.b    "dkred",0
  3506.         even
  3507. vgb_c17:    dc.b    "dkblue",0
  3508.         even
  3509. vgb_c18:    dc.b    "gray",0
  3510.         even
  3511. vgb_c19:    dc.b    "dkgray",0
  3512.         even
  3513.  
  3514. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3515. ;        load .prefs path from here
  3516. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3517.  
  3518. prefs_file_name:dc.b    "ENVARC:Wzonka-Lad.prefs",0
  3519.         even
  3520.  
  3521. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3522.         section    displayable_images,data_c
  3523. ;««««««««««««««««««««««««««««««««««««««««««««««»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
  3524.  
  3525.         cnop    0,4
  3526. image_map_1:    incbin    "data/palette_editor_still_1.bn"
  3527.         cnop    0,4
  3528. image_map_2:    incbin    "data/palette_editor_still_2.bn"
  3529.         cnop    0,4
  3530.  
  3531.         END
  3532.